jQuery检查复选框是否被选
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>检查复选框是否被选</title> <meta charset="utf-8" /> <script src="Scripts/jquery-1.12.4.js"></script> </head> <body> <form> <input type="checkbox" id="cr" name="cr" /> <input type="checkbox" id="cr2" name="cr2" checked="checked" /> </form> <script> var $cr = $("#cr");//jquery对象 var cr = $cr[0]; //dom对象 var $cr2 = $("#cr2"); var cr2 = $cr2[0]; alert($cr.checked); //undefined alert(cr.checked);//false alert(cr2.checked);//true </script> </body> </html>