Consider the following form.
<form> <input type="text" name="mytext" /> <button type="submit" name="next">next</button> <button type="submit" name="back">back</button> </form> |
In this case, we only want the jQuery validation plugin to do its thing when the ‘next’ button is clicked. If the back button is clicked we do not care about the validation.
The solution is simple. Add the CSS class ‘cancel’ to the back button.
<button type="submit" name="back" class="cancel">back</button> |
I couldn’t find this in the online docs. So hence this post.
Thanks, this is exactly what I was looking for.
I was about to go wrapping the validate in something like $(“#next_button_id”).click(function(){ …, but this works much better.
Awsome!!!
this saved me hours!
cheerssssssssssssssssssssssss