亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

jquery操作復(fù)選框checkbox的方法匯總

 更新時(shí)間:2015年02月05日 11:23:15   作者:喵小夕  
這篇文章主要介紹了jquery操作復(fù)選框checkbox的方法,實(shí)例匯總了jQuery針對(duì)checkbox進(jìn)行判斷與賦值的各種常用操作技巧,需要的朋友可以參考下

本文實(shí)例匯總了jquery操作復(fù)選框checkbox的方法。分享給大家供大家參考。具體分析如下:

jquery判斷checked的三種方法:

復(fù)制代碼 代碼如下:
$("input").attr("checked");   //版本1.6+返回:”checked”或”undefined” ,1.5-返回:true或false 
$("input").prop("checked");  //16+:true/false 
$("input").is(":checked");   //所有版本:true/false

jquery賦值checked的幾種寫(xiě)法:

所有的jquery版本都可以這樣賦值:

復(fù)制代碼 代碼如下:
$("input").attr("checked","checked"); 
$("input").attr("checked",true);

jquery1.6+:prop的4種賦值:

復(fù)制代碼 代碼如下:
$("input").prop("checked",true); 
$("input").prop({checked:true}); //map鍵值對(duì) 
$("input").prop("checked",function(){ 
    return true;//函數(shù)返回true或false 
}); 
$("input").prop("checked","checked");

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論