コレクション全体ではなく、クリックしたオブジェクトのみを返すにはどうすればよいですか?
$('[id^=opener]').click(function() {
document.write($('[id^=opener]').find(this));
});
コレクション全体ではなく、クリックしたオブジェクトのみを返すにはどうすればよいですか?
$('[id^=opener]').click(function() {
document.write($('[id^=opener]').find(this));
});
使用するだけ$(this)
です:
$('[id^=opener]').click(function() {
console.log($(this)); // this refers the target you clicked.
});
使用する :
$('[id^=opener]').click(function() {
console.log(this);
event.stopPropagation();
});
また
$('[id^=opener]').click(function(event) {
console.log(event.target);
event.stopPropagation();
});