jQuery选择器之表单选择器Demo

时间:2024-07-15 21:05:08

测试代码:

09-表单选择器.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>09-表单选择器.html</title>
  <!--   引入jQuery -->
  <script src="../js/jquery-1.4.2.js" type="text/javascript"></script>
   <script type="text/javascript">
   //<![CDATA[
   $(document).ready(function(){
           alert($("#form1 :text").length);
   });
   //]]>
   </script>
 </head>
 <body>
   <form id="form1" action="#">
     <input type="button" value="Button"/><br/>
     <input type="checkbox" name="c"/>1<input type="checkbox" name="c"/>2<input type="checkbox" name="c"/>3<br/>
     <input type="file" /><br/>
     <input type="hidden" /><div style="display:none">test</div><br/>
     <input type="image" /><br/>
     <input type="password" /><br/>
     <input type="radio" name="a"/>1<input type="radio" name="a"/>2<br/>
     <input type="reset" /><br/>
     <input type="submit" value="提交"/><br/>
     <input type="text" /><br/>
     <select><option>Option</option></select><br/>
     <textarea rows="5" cols="20"></textarea><br/>
     <button>Button</button><br/>

   </form>

   <div></div>
 <!-- Resources from http://down.liehuo.net -->
 </body>
 </html>