Saturday, 15 September 2012

How to use jQuery Validate on DIV based select form element for more than one fields -



How to use jQuery Validate on DIV based select form element for more than one fields -

hi have referred this dropdown box validation. it's working fine 1 dropdown if have more 1 means not showing correctly

$(document).ready(function () { $('.default').dropkick(); $('.example_form').validate({ highlight: function (element, errorclass) { $(element).siblings('.dk_container').addclass('error'); $('.dk_toggle').css('border', 'none'); }, unhighlight: function(element, errorclass) { $(element).siblings('.dk_container').removeclass('error'); $('.dk_toggle').css('border', '1px solid #ccc'); } }); });

here fiddle

how highlight error each field

try fiddle:

http://jsfiddle.net/ywana/5/

it fixed now.

the problem highlight code had written.

if write alert in highlight find come error

here code:

$(document).ready(function () { $('.default').dropkick(); $('.example_form').validate({ highlight: function (element, errorclass) { $(element).prev().addclass('error'); //$(element).prev().addclass('error'); $('.dk_toggle').css('border', 'none'); }, unhighlight: function(element, errorclass) { $(element).prev('.dk_container').removeclass('error'); $('.dk_toggle').css('border', '1px solid #ccc'); } });

});

jquery jquery-validate

No comments:

Post a Comment