samedi 9 janvier 2016

Add validation rules to dynamically added inputs in mvc project by jquery

Now i need to validate dynamically added fields by jquery and my form already has fields with validation in client side and in server side but in same form i added new dynamic inputs during page load but when i add validation to dynamic fields it works but eliminate validation of other fields (not dynamic)

jQuery(document).ready(function () {
        $("#i3m29_inpt_ttext").rules("add", {
            required: true,
            minlength: 2,
            messages: {
                required: "Required input",
                minlength: jQuery.validator.format("Please, at least {0} characters are necessary")
$("#htmldv").append("<input id='i3m29_inpt_ttext' type='text'>");

So now i need to validate new dynamic fields without affect on validation of other fields that already exist in the form

Aucun commentaire:

Enregistrer un commentaire