skip to Main Content

Add multiple list inside list – dart – Flutter

I have this code var sections = []; sections.add({'name': 'test', 'qustions' : []}); sections[0]['qustions'] = {'asd':'qustions 1'}; sections[0]['qustions'] = {'name':'qustions 2'}; print(sections); returns [{name: test, qustions: {name: qustions 2}}] I want it to returns something like [{name: test, qustions: [{name:…

VIEW QUESTION

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() } ); });…

VIEW QUESTION
Back To Top
Search