The FormDataEvent()
constructor creates a new FormDataEvent
object.
The FormDataEvent()
constructor creates a new FormDataEvent
object.
js
new FormDataEvent(type, formEventInit)
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 the FormDataEvent
with. This would then be accessed through the FormDataEvent.formData
property.
A new FormDataEvent
object.
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); }
Specification |
---|
HTML Standard # the-formdataevent-interface |
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 |
© 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