How to apply different conditions for multiple min value validation in jQuery Validation Plugin? -


i want validate field using jquery validation plugin. want field have minimum value, depending on other conditions. if conditions satisfied, want minimum value required 3, otherwise want 4. how achieve it?

the logic -

education: {     min: {         param: 3,         depends: function(element) {             return ( /*conditions*/ );         },         param: 4,         depends: function() {             return ( /*otherwise*/ );         },     }, }, 

try setting handler check condition want , set min value accordingly element

if(condition){   $('#education').rules("add",{min:3}); } else {   $('#education').rules("add",{min:4}); } 

as example check out jsfiddle http://jsfiddle.net/5rrga/1487/


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -