Categories

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.0

    attribute   An attribute name.

    value   An attribute value. Can be either an unquoted single word or a quoted string.

  • 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');