So I wanted to do the following has a form that has multiple input fields, so I wanted to do the following loop or something like that to get the values of the fields using jquery or js (pure) / p>
I'd like to know one way to do this
So I wanted to do the following has a form that has multiple input fields, so I wanted to do the following loop or something like that to get the values of the fields using jquery or js (pure) / p>
I'd like to know one way to do this
JQuery
// pega todos os input
var $inputs = $('form :input');
var values = {};
// percorre os inputs
$inputs.each(function() {
var name = this.name; // nome do input
var value = $(this).val(); // valor do input
});