jQuery Selector How to - Select attribute value: match value








Question

We would like to know how to select attribute value: match value.

Answer


<!--  ww w  .jav  a  2 s  . c  o m-->
<html>
  <head>
    <script type="text/javascript" src='http://code.jquery.com/jquery-1.5.2.js'></script>
    <script type="text/javascript">
    $(document).ready(function(){
        $("input[name*='Abc']").val("Abc");
    });
    </script>
  </head>
  <body>
      <input name="Abc" />
      <input name="Bcd" />
      <input name="Cde" />
  </body>
</html>

The code above is rendered as follows: