jQuery Form How to - Finds all button inputs








Question

We would like to know how to finds all button inputs.

Answer


<!--from   w w w .j  a  v  a 2s.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(){
            $(":button").css({background:"yellow", border:"3px red solid"});
        });
    </script>
  </head>
  <body>
    <body>
        <input type="button" value="Input Button"/>
    
        <input type="checkbox" />
        <input type="file" />
        <input type="hidden" />
        <input type="image" />
        <input type="password" />
        <input type="radio" />
        <input type="reset" />
        <input type="submit" />
        <input type="text" />
    
        <select><option>Option<option/></select>
        <textarea></textarea>
        <button>Button</button>
    </body>
</html>

The code above is rendered as follows: