Attribute Ends With Selector [attribute$="value"]
Categories: Attribute
jQuery('[attribute$="value"]')
Description: Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.
-
jQuery('[attribute$="value"]')
version added: 1.0attribute An attribute name.
value An attribute value. Quotes are mandatory.
-
Finds all inputs with an attribute name that ends with 'letter' and puts text in them.
HTML:
<input name="newsletter" /> <input name="milkman" /> <input name="jobletter" />
Code:
$('input[name$="letter"]').val('a letter');