input(type="checkbox"|type="radio")+jquery使用

一、用.is(":checked")判断input是否为选中状态jquery

例:this

var value=$(this).is(":checked");
localStorage.setItem("displayevelute",value);
 

 二、用.change()判断input状态是否改变索引

$("#Isdisplayevelute").change(function(){
var value=$(this).is(":checked");
localStorage.setItem("displayevelute",value);
}


三、用jquery选中name为paystate的全部单选框$("input:radio[name='paystate']"),而后.each()去遍历看那个单选框为选中状态
$("input:radio[name='paystate']").each(function(index){
var status=$(this).is(":checked");
localStorage.setItem("displayevelute",value);
})

四、$("input:radio[name='paystate']:eq(index)")能够选中是具体的input(radio)radio,index为索引五、div父盒下面有不少子元素,可用find来找到哪些input的状态是checked状态,天然当全部子input的状态变成checked状态了,就可将全选input改变成checked
相关文章
相关标签/搜索