I'm a little confused about the JQuery validation plugin behavior.
If I have the following JQuery:
$('#form1').validate({
/* other validation */
});
$('#txt1').rules("add",
{
required: true,
messages: { required: 'This is required!' }
});
and the following text input, with an id but no name attribute:
<input type="text" id="txt1"/>
No required message pops up on the text box.
However, if I add a name attribute:
<input type="text" id="txt1" name="anything"/>
It validates it just fine.
Why is that? Since I'm using the rules("add", rules) method on an ID selector, why does it need the name attribute present in order to associate rules to the element? Thanks for any insight!