2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

子要素や孫要素のボタンだけにClickイベントをつけたかった

Last updated at Posted at 2021-08-16

特定のブロックの子要素や孫要素のボタンだけにClickイベントをつけたかった

HTML

<div id="_myID">
 <input class="btn btn-primary mb-1" type="button" value="渡す">
</div>

jQuery

$('#_myID').find('.btn').click(function() {
    console.log('クリックされました!');
});

実際には孫要素で使っています。

2
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?