Latest web development tutorials

jQuery [attribute ~ = value] Selector

jQuery selector jQuery selector

Examples

Select all <input> element with the attribute name contains the word "nation" of:

$("input[name~='nation']")

try it"

Definition and Usage

[Attribute ~ = value] selector to select each element with a specified attribute and value contains the specified words.

Tip: The word can contain spaces.


grammar

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

参数 描述
attribute 必需。规定要查找的属性。
value 必需。规定值要包含的单词。


jQuery selector jQuery selector