jquery - Validating two dropdowns in a single anchor tag click event -


i have validate 2 dropdowns in anchor tag click event.

$(".viewmore").on('click',function(event){     return   requiredvalidation($(this).parents('.box01').find(".color"));     return   requiredvalidation($(this).parents('.box01').find(".size"));  }); function requiredvalidation(ddl) {      ddl = $(ddl);      var isvalid = true;     if (jquery.trim(ddl.val()) == 'vÆlg' ) {         isvalid = false;         ddl.addclass("error");      }     else {         ddl.removeclass("error");     }      return isvalid; } 

but first 1 validating here.can 1 give clue?

use

$(".viewmore").on('click',function(event) {     var valid1 =  requiredvalidation($(this).parents('.box01').find(".color"));     var valid2 =   requiredvalidation($(this).parents('.box01').find(".size"));     return valid1 && valid2; }); 

you returning after first select validated, need validate both input fields combine result


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -