FormDataEvent()
The FormDataEvent()
constructor creates a new FormDataEvent
object.
Syntax
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
let fd = new FormData();
fd.append('test', 'test');
let fdEv = new FormDataEvent('formdata', { formData: fd });
for (let value of fdEv.formData.values()) {
console.log(value);
}
Specifications
Specification |
---|
HTML Standard # the-formdataevent-interface |
Browser compatibility
BCD tables only load in the browser