I have basic javascript code to generate input text areas as below
$(\"#btnAdd\").click(function (e) {
var itemIndex = $(\"#container input.iHidden\
You could use the .rules('add') method immediately after the new input element is created...
$("#btnAdd").click(function (e) {
var itemIndex = $("#container input.iHidden").length;
e.preventDefault();
var newItem = $("" + itemIndex + "
");
$("#container").append(newItem);
// add the rules to your new item
$('Interests_' + itemIndex + '__Id').rules('add', {
// declare your rules here
required: true
});
});
Alternatively, for a simple rule like required, you could just add the required="required" attribute to the new element when you create it...
$("#btnAdd").click(function (e) {
var itemIndex = $("#container input.iHidden").length;
e.preventDefault();
var newItem = $("" + itemIndex + "
");
$("#container").append(newItem);
});