Web APIs

FormData()

Try the free JavaScript compiler

Creates an entry list, optionally populated from a form and a selected submitter. Does not send a network request.

Formal Syntax & Structure

javascript syntaxjavascript
new FormData(form?, submitter?)

Parameters & Attributes

NameTypeDescription
formHTMLFormElementOptional form to read.
submitterHTMLElementOptional associated submit button.

Return Value

FormData

New entry list.

Working Example

Example Snippetjavascript
const f=document.createElement("form");for(const [name,value,disabled] of [["item","pen",false],["hiddenField","x",true],["","ignored",false]]){const i=document.createElement("input");i.name=name;i.value=value;i.disabled=disabled;f.append(i);}console.log(JSON.stringify([...new FormData(f)]));
JavaScript Reference