浅析jquery与checkbox的checked属性的问题_jquery

WBOY
Release: 2016-05-16 15:03:27
Original
1511 people have browsed it

1、页面加载成功后,点击选中或取消选中该checkbox,checkbox属性里的checked属性不会根据该checkbox是否选中而变化

2、checkbox里的onchange或onclick方法里用jquery的attr方法获取checked是看得到的checked属性的值与它是否给钩上没有关系

3、使用document.getElementById("checkbox_id").checked获取的值与是否钩上一至,即与所见即所得

4、使用$("#checkbox_id").attr("checked")获取的值与里的checked情况一至,不是所见即所得

5、使用$("#checkbox:checked")获取的都是被钩上的checkbox

6、document.getElementById("checkbox_id").checked=true,控件里的checked属性没有显示出来,所做即所见

7、$("#checkbox_id").attr("checked",true),控件里的checked属性显示出来,所做即所见,同时代码也会变化

以上这篇浅析jquery与checkbox的checked属性的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!