jQuery html()の例
jQueryhtml()は、一致した要素の最初の要素のhtmlコンテンツを取得するために使用されます。一方、html(‘new html content’)は、一致したすべての要素のhtmlコンテンツを置換または設定するために使用されます。
たとえば、同じクラス名「AClass」を含む2つのdiv要素。
ABC 1ABC 2
1. $(‘.AClass’).html()
これは「ABC 1」のみを取得し、2番目に一致した要素「ABC2」は無視されます。
2. $(‘.AClass’).html(‘This is new text‘)
これにより、一致したすべての要素のHTMLコンテンツが置き換えられます。
This is new textThis is new text
jQuery html()の例
jQuery html() example
I'm going to replate by something ....I'm going to replate by something 2....