JSFiddle - React, Tailwind, and code Playground
by Joe Saad
HTML
<form action="">
<input type="text" id="term1">
<input type="text" id="term2">
<input type="text" id="term3">
<button type="button">Submit</button>
</form>
JavaScript
$('button').click(function(){
var formOfInputs = [];
$('input').each(function(e){
var inputObject = {};
inputObject[$(this).attr('id')] = $(this).val();
formOfInputs.push(inputObject);
});
console.log(formOfInputs);
})