양식 객체 등록 정보 선택기

10258 단어 선택기
$("input:enabled") $("input:disabled") $(":checkbox:checked") $(":checkbox:not(:checked) $("select option:selected")
 
 1 <html>
 2   <head>
 3     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
 4     <script type="text/javascript" src="../js/jquery-1.8.2.js"></script>
 5   </head>
 6   <body>
 7     <form>
 8       <input name="email" disabled="disabled" />
 9       <input name="password" disabled="disabled" />
10       <input name="id" />
11       <input type="checkbox" name="newsletter" checked="checked" value="Daily" />
12       <input type="checkbox" name="newsletter" value="Weekly" />
13       <input type="checkbox" name="newsletter" checked="checked" value="Monthly" />
14         <select>
15           <option value="1"> </option>
16           <option value="2" selected="selected"> </option>
17           <option value="3"> </option>
18         </select>
19     </form>
20     <script type="text/javascript">
21     
22     //1) input 
23         //alert( $("input:enabled").size() );
24     
25      //2) input 
26          //alert( $("input:disabled").size() );
27      
28      //3) 
29          //alert( $(":checkbox:checked").size() );
30      
31      //4) 
32          //alert( $(":checkbox:not(:checked)").size() ); 
33      
34      //5) 
35          //alert( $("select option:selected").size() );
36          
37      //6) 
38          alert( $("select option:selected").html() );
39      
40     </script>
41   </body>
42 </html>

좋은 웹페이지 즐겨찾기