Attribute Ends With Selector [name$=”value’]

It selects all the elements that ends with a given string. It represents element with attribute name whose value is ends with given value.

Description: Selects elements that have the specified attribute with a value ending exactly with a given string.

The comparison is case sensitive.


attribute: An attribute name.

value: An attribute value Can be either a valid identifier or a quoted string.


Finds all inputs with an attribute name that ends with ‘letter’ and puts text in them.

<!DOCTYPE html>
<html lang="en">
   <meta charse"utf-8">
   <title>attributeEndsWith demo</title>
   <script src=""></script>

<input name="newsletter">
<input name= "milkman">
<input name="job letter">

$( "input[name$='letter']").val("a letter");



Leave a Reply

Your email address will not be published. Required fields are marked *