jQuery [attribute~=value] セレクタ

❮ jQuery Selectors

指定の単語 "nation" を含む name 属性を持つ全ての <input> 要素を選択する:

$("input[name~='nation']")
Try it Yourself »

定義と用法

[attribute~=value] セレクタは、指定の属性を持ち、 その属性値が指定の文字列(単語)を含む各要素を選択します。

チップ:文字列には、空白を含むことができます。


構文

$("[attribute~='value']")

パラメータ 説明
attribute 必須。検索する属性を指定する
value 必須。文字列値を指定する

❮ jQuery Selectors