offline version v3


⊗jsSpFmFDIt 242 of 281 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.

enru