Loop on html objects and obtain a single array of objects – Jquery
I have some html objects like: <input id="myfield1" class="fields_to_iterate"> <input id="myfield2" class="fields_to_iterate"> <input id="myfield3" class="fields_to_iterate"> <input id="myfield4" class="fields_to_iterate"> <input id="myfield5" class="fields_to_iterate"> and if I do in javascript: $('.fields_to_iterate').each( (index, element) => { myObject.push( { [$(element).attr('id')] : $(element).val() } ); });…