jQuery [attribute~=value]Selector

jQuery 选择器jQuery Selector

Example

Select all <input> elements with a name attribute containing the word "nation":

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

Try it Yourself »

Definition and Usage

The [attribute~=value] selector selects each element with the specified attribute whose value contains the specified word.

Tip:The word can contain spaces.


Syntax

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

Parameter Description
attribute Required. Specifies the attribute to find.
value Required. Specifies the word that the value must contain.


jQuery 选择器jQuery Selector

Other Extensions