http://jqfundamentals.com/chapter/jquery-basicsからの明示的な反復の次の例を見ています。
$( 'li' ).each(function( index, elem ) {
// this: the current, raw DOM element
// index: the current element's index in the selection
// elem: the current, raw DOM element (same as this)
$( elem ).prepend( '<b>' + index + ': </b>' );
});
コメントはelem
未加工の DOM 要素として参照されますが、コードは.prepend()
on を呼び出しますelem
。
私はjQueryを使い始めたばかりですが、生のDOM要素ではなく、jQueryオブジェクトでのみjQueryメソッドを呼び出すことができると理解しています。私は誤解していますか?