jQuery attribute contains prefix selector
Description and Syntax
$('[foo|=bar]')
selects all elements that have the
foo
attribute with a value either
equal to bar
, or beginning with bar
and a hyphen (-
).
Examples
$('[id|=hello]')
selects all elements with anid
ofhello
or anid
that begins withhello-
$('a[hreflang|=en]')
selects all<a>
elements with ahreflang
value of en or beginning withen-
$('a[hreflang|=en]')
matches<a href="example.html" hreflang="en">Some text</a>
as well as<a href="example.html" hreflang="en-UK">Some text</a>
.