I am trying to disable validation before sending after an error occurs. The onfocusout handler works fine, but onclick does not work for a checkbox or select element.
As a quick example, I wrote the following. If you submit an empty form and then adjust the checkbox and select, they should not be checked immediately. You will see that text input is working correctly.
The selection seems to work sometimes, regardless of the onclick handler. He did an onclick check in safari, not in chrome.
Fiddle: http://jsfiddle.net/ebMdq/6/
<form id="myForm" action=""> Name: <input type="text" name="fname" /><br /> Do you Rawk? <input type="checkbox" name="rock" /><br /> choose color: <select id="color" name="color" class="required"> <option value="">Choose One</option> <option value="blue">blue</option> <option value="blue">red</option> </select><br /> <input type="submit" /> </form>β $(function () { var validator = $("#myForm").validate({ onfocusout: false, onkeyup: false, onlclick: false, rules: { fname: "required", rock: "required", color: "required" }, messages: { fname: "Enter your firstname", rock: "you know you do", color: "pick one!", }, }); });
source share