javascript - Custom error class not applying to all the checkbox when the button is click using jquery validation -


currently facing issue in checkbox when user click yes radio button panel filed displayed when user click next button error class applying first check box should apply check box question might easy how not getting exact result. here jquery code

        $(".phy_clp").click(function() {     var inputvalidation = $('input[name=phy_clp]:checked').val();      if (inputvalidation === "yes") {         $phyexpydiv.show();         $(".phyexpy").find(".chk_field_hlt").removeclass("chk_field");          //$(".chk_field_hlt").addclass('errred_chkb');     } else if (inputvalidation === "no") {         $(".chk_field_hlt").removeclass('errred');         $(".phyexpy").find(".chk_field_hlt").addclass("chk_field");         $phyexpydiv.hide();     }  }); 

here fiddle link

thanks in advance

in highlight , unhighlight, refer the source code of plugin can see default code handles radio buttons properly.

since you're over-riding default code, you'll need similar checkbox elements.

highlight: function (element) {     if (element.type === "checkbox") {         this.findbyname(element.name).addclass('errred').removeclass('text-error-black');     } else {         $(element).addclass('errred');         $('#imageuploadform').addclass('errred');         $(element).prevall('label').find('span.required-star').addclass('text-error-red').removeclass('text-error-black');     } }, unhighlight: function (element) {     if (element.type === "checkbox") {         this.findbyname(element.name).addclass('text-error-black').removeclass('errred');     } else {         $(element).removeclass('errred');         $(element).prevall('label').find('span.required-star').addclass('text-error-black').removeclass('text-error-red');    } } 

demo: http://jsfiddle.net/t8jz98sf/1/


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -