<input type="checkbox" value="点击按钮" />
<input type="button" value="点击按钮" />
<script type="text/javascript">
$("[type=button]").click(function(){
$("[type=checkbox]").attr("checked"); //返回undefined
$("[type=checkbox]").prop("checked"); //返回false
});
</script>
- 如果在
checkbox中添加checked="checked",则attr()返回checked,prop()返回true。 - 同理可适用于
selected和disabled








网友评论