jQuery [attribute~=value] Selector
Example
Select all elements with a name attribute that contains the word "nation" element:
$("input[name~='nation']")
Try it »
Definition and Usage
The [attribute~=value] selector selects every element with the specified attribute whose value contains the specified word.
**Tip:** The word can contain spaces.
Syntax
$("[
attribute~
=
'value'
]")
| Parameters | Description |
|---|---|
| attribute | Required. Specifies the attribute to look for. |
| value | Required. Specifies the word the value must contain. |
jQuery selector