JQ至少選擇一個(gè)復(fù)選框代碼
所屬欄目: 網(wǎng)站開(kāi)發(fā) | 更新時(shí)間:2016-7-8 | 閱讀:3818 次
<html> <head> <title></title> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript"> $(function(){ $('#submit').click(function(){ if($(":checkbox[checked = true]").size()<1){ alert("最少選擇一個(gè)復(fù)選框!"); return false; } alert('OK') }); }) </script> </head> <body> <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="checkbox" > <input type="button" id="submit" value=" 提 交 "> </body> </html>