1
I got this div, that’s <div class='pergunta'>
, inside of her I have <input type='text'> <select></select> <input type='checkbox'>
The point is that this entire div can repeat itself if I click add new question, that is, I can have 1 or N Divs that contain these same fields, I need to make a Javascript/jQuery script that takes the value of each field and stores it in an array, for example, I have two <div class'pergunta'>
with these fields, I need to add the values of each field in an array for example:
var array = [{titulo: , tipo: , requerido: }, {titulo: , tipo: , requerido: }]
That is, how do I add the values of these fields from each div into an array?
It worked!! The problem is that when I try to send this 'arr' via ajax, POST method, it is returning me the following error: "Uncaught Typeerror: Illegal Invocation".
– Leonardo Theodoro
@Leonardotheodoro, use it
.get()
at the end to turn into a native array instead of jQuery collection.– Sergio