I am trying to click a save button and then call the validate function on my div section where all the fields that need validation have the required tag.
<script type="text/javascript">
$(document).ready(function () {
$("#button").click(function() {
$('#MyDIv').valid();
});
});
</script>
<div id="MyDIv">
<input type="text" class="required" id="id1" />
<input type="text" id="id2" />
<input type="button" id="button" />
</div>
With this code I am getting a validator is undefined error. I cannot use a form.
DEMO: http://jsfiddle.net/3BKcp/2/
Wrap a
<form>tag around your form fields like so:and change your JavaScript to the following: