javascript - How to validate form using JQuery when only one particular button is pressed? -


i have form 2 submit buttons on it. buttons must of submit type , can't change it.

how can make jquery not validate submit form when first button pressed , validate , submit when second button pressed?

thank

event.originalevent.explicitoriginaltarget gecko-specific property (see this question , answer).

the following should work:

var dovalidate; $('#validating-button').click(function () { dovalidate = true; }); $('#non-validating-button').click(function () { dovalidate = false; }); $('#form').validate({     rules: {         myinputname: {             required: function () { return dovalidate; }         }     } }); 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -