« firefox下border-collapse:collapse当table下有rowspan的bugx200联想一键还原失效的解决办法。 »

jquery实现chekcbox选中,取消操作。

代表如下: 

=============================================================================================

$('.option_dl dd li label').click(function(e){
        if ($(this).find("input").attr("type") == "radio") {
            $(this).parents(".option_dl").find("label").removeClass("current");
            $(this).addClass("current");
            $(this).find("input").eq(0).attr("checked", true);
        }else if($(this).find("input").attr("type") == "checkbox"){
    var isChecked=$(this).find(":checkbox").attr("checked");
    if(isChecked){
     $(this).removeClass("current");
    $(this).find(":checkbox").attr("checked",false);
    return false;
    
    }else{
    $(this).find(":checkbox").attr("checked",true);
     $(this).addClass("current");
    return false;
    
    }
  }
  
    })
 $('.option_dl dd li label').find(":checkbox").click(function(e){
    if($(this)[0].checked){
    $(this).parent("label").addClass("current");
     $(this).attr("checked",true);
   e.stopPropagation();
   
    }else{
     $(this).attr("checked",false);
   $(this).parent("label").removeClass("current");
   e.stopPropagation();
   
    }
 })
 $('.option_dl dd li label').find(":radio").click(function(){
   $(this).parent("label").addClass("current");
   $(this).attr("checked",true);
 }) 

  • 相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Arwen Build 81206

湘 ICP 备 06003756 号
Copyright 山寨 Rights Reserved.