遇到操作checkbox的问题
全选
复制代码 代码如下:
复制代码
$("input[type='checkbox']").each(function(){
this.checked=true
})
反选
$("input[type='checkbox']").each(function(){
if(this.checked){
this.checked=false
}
else{
this.checked=true
}
$("input[type='checkbox']").each(function(){
this.checked=true
})
反选
$("input[type='checkbox']").each(function(){
if(this.checked){
this.checked=false
}
else{
this.checked=true
}
理论上是应该可以用$(obj).attr("checked",true)来操作恶但是在ie下正常,在firfox下反选效果却失灵了,$(obj).removeattr("checked")不起作用,不知道怎么回事。
干脆直接用js操作dom属性,没有问题。
最后
以上就是完美小虾米最近收集整理的关于js操作checkbox遇到的问题解决的全部内容,更多相关js操作checkbox遇到内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复