The FormDataEvent()
constructor creates a new FormDataEvent
object.
On this page
FormDataEvent: FormDataEvent() constructor
Syntax
js
new FormDataEvent(type, formEventInit)
Parameters
-
type
-
A string with the name of the event. It is case-sensitive and browsers always set it to
formdata
. -
options
-
An object that, in addition of the properties defined in
Event()
, can have the following properties:-
formData
-
A
FormData
object to pre-populate theFormDataEvent
with. This would then be accessed through theFormDataEvent.formData
property.
-
Return value
A new FormDataEvent
object.
Examples
js
const fd = new FormData();
fd.append("test", "test");
const fdEv = new FormDataEvent("formdata", { formData: fd });
for (const value of fdEv.formData.values()) {
console.log(value);
}
Specifications
Specification |
---|
HTML Standard # the-formdataevent-interface |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
FormDataEvent |
77 | 79 | 72 | No | 64 | 15 | 77 | 77 | 79 | 55 | 15 | 12.0 |
See also
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FormDataEvent/FormDataEvent