jQuery Attribute Ends With Selector
February 25, 2013
jQuery provides API to find all those element whose attribute is ending with a given selector. It does not match with word instead it only checks expression.
<input type="button" name="abxy"/>
<script>$('input[name$="xy"]').val('CLICK');</script>
<!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <input type="button" name="xyd"/> <input type="button" name="abxy"/> <input type="button" name="axybd"/> <input type="button" name="abxcy"/> <script>$('input[name$="xy"]').val('CLICK');</script> </body> </html>
Output