jQuery $(this) と JavaScript this の違い

スポンサーリンク

これもよく忘れるのでメモ

jQueryの$(this)はjQueryオブジェクトとしてその時選ばれている要素が格納される。

オブジェクトなのでconsoleで見ると様々なプロパティが格納されている。

jQueryにおける$(this)[0]がJavascriptのthisと同じ。

jQueryオブジェクト第一変数にはvanila Javascriptで言うdocument.getElementBy~の値が格納されている。

What's the difference between '$(this)' and 'this'?
I am currently working through this tutorial: Getting Started with jQuery For the two examples below: $("#orderedlist").find("li").each(function (i) { $(t...

コメント

タイトルとURLをコピーしました