SubmitEvent()
-
Creates and returns a new
SubmitEvent
object whosetype
and other options are configured as specified. Note that currently the only validtype
for aSubmitEvent
issubmit
.
SubmitEvent()
Creates and returns a new SubmitEvent
object whose type
and other options are configured as specified. Note that currently the only valid type
for a SubmitEvent
is submit
.
In addition to the properties listed below, this interface inherits the properties of its parent interface, Event
.
submitter
Read onlyAn HTMLElement
object which identifies the button or other element which was invoked to trigger the form being submitted.
While SubmitEvent
offers no methods of its own, it inherits any specified by its parent interface, id
is used to identify which payment processor the button corresponds to.
let form = document.querySelector("form");
form.addEventListener("submit", (event) => {
let submitter = event.submitter;
let handler = submitter.id;
if (handler) {
processOrder(form, handler);
} else {
showAlertMessage(
"An unknown or unaccepted payment type was selected. Please try again.",
"OK",
);
}
});
The handler ID is obtained by using the submit
event's About