JSFiddle: https://jsfiddle.net/fho6m3cr/33/
I'm using jQuery Validation without a Submit button -- instead there's a regular button that invokes $('#form).valid()
.
I populate my initial fieldset in document.onReady and then 1 more dynamic field after you click the Add button. The Add button receives its rule but never gets picked up and skips validation.
I initialize as
// First initialize jQuery Validation
$("#form").validate({});
// Add first-level validators
$("#form select, #form input:not(input[type=button], input[type=submit], input[type=hidden])").each(function(){
$(this).rules("add", { required: true } );
});
and then Add is supposed to handle the new field by adding the same Select/Input validation when it's clicked.
// (Re-)append validator
$("#form select, #form input:not(input[type=button], input[type=submit], input[type=hidden])").each(function(){
$(this).rules("add", { required: true } );
});
But it's not working: the newly-added field doesn't get validated. The original one does. The structure of the Form and subsequent DIV is correct.
NOTE There is only 1 possible click of the Add button -- no unique IDs anywhere.