3

コレクション全体ではなく、クリックしたオブジェクトのみを返すにはどうすればよいですか?

 $('[id^=opener]').click(function() {
     document.write($('[id^=opener]').find(this));
 });
4

2 に答える 2

4

使用するだけ$(this)です:

 $('[id^=opener]').click(function() {
     console.log($(this)); // this refers the target you clicked.
 });
于 2012-12-23T07:24:53.900 に答える
4

使用する :    

 $('[id^=opener]').click(function() {
     console.log(this);
    event.stopPropagation();
 });

また

$('[id^=opener]').click(function(event) {
    console.log(event.target);
    event.stopPropagation();
});
于 2012-12-23T07:28:54.960 に答える