I am using Bootstrap (plugin): validator.js v0.11.9 bootstrap validator for field validations in a Python project (Python version 3.6 and Django version 1.11). On a button click
I have added couple of fields to the form using jquery -
JQuery :
$("#button1Id").click(function(){
$("#divInsideFormId").append('filed1-selectoption, field2-datepicker, field3-textbox');
});
According to the docs validator fields
By default, the validator will only validate fields that are present when the plugin is initialized. If your form has a dynamic set of fields, you will need to call $(...).validator('update')
to inform the plugin that the set of fields to be validated has changed.
I tried the following -
$("#button1Id").click(function(){
$("#divInsideFormId").append('filed1-selectoption, field2-datepicker, field3-textbox');
$("#formId").validator('update');
});
This did not work. I also tried - $("#divInsideFormId").append(...).validator('update');
Even this isn't working.
Can anyone suggest what's wrong with my code or if I am missing something?