return false not working in jquery require field validation -
i have dropdownlist (.color) validate jquery.default value of dropdown vÆlg.and want validate in anchor tag click (.viewmore).my code this
$(".viewmore").on('click',function(event){ requiredvalidation($(this).parents('.box01').find(".color")); }); function requiredvalidation(ddl) { ddl = $(ddl); var isvalid = true; if (jquery.trim(ddl.val()) == 'vÆlg' ) { isvalid = false; ddl.addclass("error"); } else { ddl.removeclass("error"); } alert(isvalid) return isvalid; }
at last alert message getting value false correctly.but still page redirect given url of anchor tag.can 1 tell me whats going wrong?
try this
return requiredvalidation($(this).parents('.box01').find(".color"));
Comments
Post a Comment