I have my form:
<input type="text" name="" placeholder="nombre">
<input type="text" name="" plaholder="apellidos">
<select>
<option>seleccion 1</option>
<option>seleccion 2</option>
<option>seleccion 3<option>
</select>
I want all the data entered in these fields to be all entered also in a textarea:
<textarea></textarea>
how can i do it using jquery or javascript?
You need to identify each entry, Select, etc. with a class ID, etc. Then from the javascript you get the data entered in each one and save it either in a string or array as works best for you. Then there is data you set in the textarea.
You need to add a
id
to them so that you can take the value of each input and each select you could do something like this:Good afternoon, I propose the same solution, but with Jquery, which in my opinion simplifies the code more.
The interesting thing about Jquery is the way to access the elements, in this case, as we handle the 'id' attribute, we access it by means of a # and the name of that id , in this way: $('#nameId'); and .val() , it simply gets the value of the input.
I hope it helps you in something.