I want to validate a form that is dynamically generated. If I enter 123 in the form, it always returns true. Here is the code where I dynamically create the form:
//create dummy form so we can validate
$(".clearfix").append('<form action="#" id="dummyform" method="POST">');
$("#dummyform").append('<input type="text" name="dummyelement" class="date form-control" id="dummyelement"/>');
Apparently, the jQuery Validate plugin thinks
"123" is a valid value for the
date rule. Conversely, enter
"abc" and it's not valid.
In other words, you are doing nothing wrong, and should report this as a bug to the developer on his GitHub page. Include the jsFiddle below inside your bug report.
BTW, you do not need to use
class="date" along with
date: true... that is a redundant declaration of the rule.