内容简介:使用$.fn.attr来获取或设置html的checkbox元素的状态,比如:这时使用 prop 即可
使用$.fn.attr来获取或设置html的checkbox元素的状态,比如:
<input id="chb_data_binding" type="checkbox">
$('#chb_data_binding').attr('checked', true)
但是界面上此复选框并没有反映到界面上,因为这个只是改变html的DOM结构,并不改变当前选中状态,比如:
$('#chb_data_binding').attr('checked') > 返回 checked $('#chb_data_binding').is(':checked') > false
这时使用 prop 即可
$('#chb_data_binding').prop('checked', true) $('#chb_data_binding').prop('checked') > true
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- JQuery选中select组件被选中的值方法
- JQuery选中select组件被选中的值方法
- android 中心区域选中图表 WheelChart
- python – Django检查是否选中了复选框
- 在ng-repeat内Checkbox默认选中
- Xshell 配置 鼠标选中即复制,右键即粘贴的功能
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Ordering Disorder
Khoi Vinh / New Riders Press / 2010-12-03 / USD 29.99
The grid has long been an invaluable tool for creating order out of chaos for designers of all kinds—from city planners to architects to typesetters and graphic artists. In recent years, web designers......一起来看看 《Ordering Disorder》 这本书的介绍吧!