Attribute Equals Selector [name=value] in JQuery



version added: 1.0jQuery(‘[attribute=value]’)

  • attribute
    An attribute name.
    An attribute value. Quotes are optional.


Finds all inputs with name ‘newsletter’ and changes the text of the span next to it.

<!DOCTYPE html>
  <script src="/scripts/jquery-1.4.js"></script>

    <input type="radio" name="newsletter" value="Hot Fuzz" />

    <input type="radio" name="newsletters" value="Cold Fusion" />

    <input type="radio" name="accept" value="Evil Plans" />

<script>$("input[name='newsletter']").next().text(" is newsletter");</script>

Leave a Reply

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