jQuery Tutorial Tutorials - jQuery [name|="value"] selector

jQuery [name|="value"] selector

The jQuery Attribute Contains Prefix Selector [name|="value"] is used to select elements with a specific attribute which has a specific string value or starting with value followed by a hyphen(-). It is case sensitive.

jQuery [name|="value"] selector Syntax

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

jQuery [name|="value"] selector Examples

selector description matched not matched
$('a[hreflang|="en"]') find all links with an hreflang attribute that is equal to en or start with en- hreflang="en"
hreflang="en-US"
hreflang="english"
$('[class="comp"]') find elements with class value equal to open or start with open- class="comp"
class="comp-item"
class="comp-item show"
class="company"
$("input[name|='man']") Find all input elements that name is equal to man or begin with man- <input name="man-day">
<input name="man">
<input name="fireman">
It is case sensitive.<input name="Man"> is not matched.

Finds all li elements with a title attribute that is equal java or begin with java-.
Try now

Date:2019-08-17 10:50:27 From:www.Lautturi.com author:Lautturi