<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 3 年前。
当我点击一个复选框时,为什么没有添加选中的属性?。你可以在这里看到代码
http://jsfiddle.net/FCrSg/
最佳答案
HTML 属性 checked
表示:默认情况下 在页面加载时选中。单击复选框时,这不会改变。
<input type="checkbox" checked="checked"> <!-- The HTML attribute -->
DOM 属性 checked
实际上是复选框的当前状态,可以是 true/false。这将在复选框被点击时改变,但在您检查 HTML 时不可见。
$('input:check')[0].checked == true;
// Whether or not the checkbox is currently checked
关于javascript - 为什么点击复选框不添加选中的属性 ='checked',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38021878/