tags:

views:

54

answers:

1

I am having following js code(similar-sample here) that creates form

function addsection(){
   var newForm = $("<form id='forma1'/>").submit(submit call here).validate();

   --for loop i 1 to 5
   {
       var inpt = $("<input />").attr('name', 'inpt').addclass('required').appento(newform);
       if(x)
          inpt.att('type', 'checkbox');
       else
          inpt.att('type', 'radio');
   }

   $('#div1').append(newForm);
}

Problem is it does not do validation.

To perform validation i have done

1> called validation() function (also tried calling at bottom of code once everything is added into form but same result)

2> added required class for input

How can i apply validation using jquery validator plugin in here? is there anything i am doing wrong in here

A: 

The problem is probably that you first call validate and then you are adding validation information.

Try appending the form first and then calling validate.

kgiannakakis