⊗jsSpFmFDIt 242 of 294 menu

FormData iterators in JavaScript

FormData is an iterable. Accordingly, the values, keys, entries iterators are built into it.

Let's iterate over the values of form elements:

for (let value of formData.values()) { console.log(value); }

Now let's loop through the names of form elements:

for (let key of formData.keys()) { console.log(key); }

Now let's iterate over the key-value pairs of form elements:

for (let entry of formData.entries()) { console.log(entry); }

Given a form with three inputs. Get the form data and loop through it.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline