13
15

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 5 years have passed since last update.

jqueryで一部の要素を対象外にする

Posted at

サイト共通で設定してしまったセレクタから一部を非対象にしたい場合

[使いどころ]
後から共通処理を追加する場合等で、対象にしたくない要素がある場合。

$('a[href^=#]').click(function() { console.log('here'); });

class='hoge'を除くには

$('a[href^=#]:not(.hoge)').click(function() { console.log('here'); });

※マニュアルにあったが備忘。

13
15
0

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
13
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?