Edit The Code:
See Result »
Try it Yourself - ©
w3big.com
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>本教程(w3big.com)</title> <script src="http://cdn.static.w3big.com/libs/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ $("#p1").html("attr('checked'): " + $("input").attr('checked') + "<br>prop('checked'): " + $("input").prop('checked')); }); }); </script> </head> <body> <p><b>注意:</b>确认或取消选中该复选框,然后单击按钮刷新内容。</p> <button>查看attr() 和 prop() 的值</button> <br><br> <input id="check1" type="checkbox" checked="checked"> <label for="check1">Check me</label> <p id="p1"></p> </body> </html>