Yes, I know this question has been asked a few times before. But I am confused with the answers. I thought I would have to somehow 'refresh' or use live to add the validation each time I add a new input field.
Also I checked out the demo and I think I am missing something. I don't really see any code that adds validation each time a new field gets added.
This is a simplified version of my code:
$(function(){
$('#testform').validate();
var input1 = $('<input type="text" class="required" />'):
var input2 = $('<input type="text" class="required" />'):
var input3 = $('<input type="text" class="required" />'):
$('#testform').append(input1)
.append(input2)
.append(input3);
});
My html looks something like this:
<form id='testform'>
<input type='submit' value='submit' />
</form>
For some reason validation only works on the first element. If you fill in text it works on the onblur event. But the form will submit once the first input field has text.
Actually I think just found the answer while typing this but I'll add this question anyway in case others run into the same problem. If this is a problem I'll remove it right away.
type="test"isn't a valid<input>element :)