jQuery [attribute|=value] Selector
Example
Select all elements with a title attribute that starts with "Tomorrow"
element:
$("p[title|='Tomorrow']")
Try it »
Definition and Usage
The [attribute|=value] selector selects every element with the specified attribute whose value equals the specified string (such as "en") or starts with that string followed by a hyphen (such as "en-us").
**Tip:** This selector is often used to handle the language attribute.
Syntax
$("[
attribute|
=
'value'
]")
| Parameters | Description |
|---|---|
| attribute | Required. Specifies the attribute to look for. |
| value | Required. Specifies the string with which the attribute value must start. |
More examples
Handle the language attribute
This example selects all elements with an hreflang attribute that starts with the value "en" .
jQuery selector