GET FORM DATA JS [closed]

1

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

    
asked by anonymous 30.07.2018 / 13:57

1 answer

2

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
});
    
30.07.2018 / 14:05