jQuery –セレクターの例ではありません
jQueryでは、「not」を使用して、セレクターと一致しないすべての要素を選択します。
例
-
$(‘p:not(.class-p1)’) – selects all elements matched by
that do NOT have a class name of “class-p1”.
-
$(‘li:not(:only-child)’) – selects all elements matched by
- that are NOT the only child of their parent.
-
$(‘li:not(:first-child)’) – selects all elements matched by
that are NOT the first child of their parent. jQueryの例
jQueryの「not」セレクターの使用方法を示す簡単な例は、ボタンをクリックして再生します。
jQuery not example jQuery not example
- class-ul - #1
- class-ul - #2
- class-ul - #3
- class-ul - #4
- class-ul - #5
- id1 - #1
class - #p1
class - #p2
Related
- jQuery - タグの値または要素の内容を取得する方法
- jQueryで複数の要素を選択する
- jQuery - 空のセレクタの例
- jQueryのclick()とdblclick()の例
- jQuery - 属性セレクタの例
- jQueryを使ったマッシャブル浮動エフェクトの例
- jQuery - 隣接する兄弟セレクターの例
- jQuery - 子セレクタの例
- jQueryを使って実行時にJavaScriptをロードする方法
- Spring 4 MVC Ajax Hello Worldの例
- jQuery prepend()とprependTo()の例
- jQuery - ユニバーサルセレクタの例
- jQuery - Descendantセレクタの例
- jQueryのchildren()の例
- jQuery - 一般的な兄弟セレクターの例
- jQueryでページを更新するには?
- jQuery - nth-childセレクターの例
- jQueryでコピー、ペースト、カットの動作を検出する方法
- jQuery - ユニバーサルセレクタの例
- jQuery - CSSクラス名とIDを持つ要素を取得する方法