The FormDataEvent() constructor creates a new FormDataEvent object instance.
Syntax
new FormDataEvent(type[, formEventInit]);
Values
type- A
DOMStringrepresenting the name of the event. formEventInitOptional- A
FormEventInitdictionary, which can take the following optional fields:bubbles: aBooleanindicating whether the event bubbles. The default isfalse.cancelable: aBooleanindicating whether the event can be cancelled. The default isfalse.composed: aBooleanindicating whether the event will trigger listeners outside of a shadow root (seeEvent.composedfor more details). The default isfalse.formData: AFormDataobject to pre-populate the FormDataEvent with. This would then be accessed through theFormDataEvent.formDataproperty.
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 | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'FormDataEvent' in that specification. |
Living Standard | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
FormDataEvent() constructor | Chrome Full support 77 | Edge Full support 79 | Firefox Full support 72 | IE No support No | Opera Full support 64 | Safari No support No | WebView Android Full support 77 | Chrome Android Full support 77 | Firefox Android No support No | Opera Android Full support 55 | Safari iOS No support No | Samsung Internet Android Full support 12.0 |
Legend
- Full support
- Full support
- No support
- No support
