私はjQueryの本を読んでいますが、時々次のような例を目にします:
$('img[alt]').each(function(){
$(this).replaceWith('<span>' + $(this).attr('alt')+ '</span>')
}
そして時々私は次のような例を見ます:
$('*').attr('title', function(index, value) {
return value + 'I am element ' + index + ' and my name is ' + this.id);
});
$(this)
時々それがそうであり、時にはそれがただであるのを見てくださいthis
違いは何ですか?どちらをいつ使用するかを知るにはどうすればよいですか?