MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / onsubmit

Method onsubmit

code/solutions/21_2_comment_field_resets.mjs:19–26  ·  view source on GitHub ↗
(event)

Source from the content-addressed store, hash-verified

17 this.comments,
18 elt("form", {
19 onsubmit(event) {
20 event.preventDefault();
21 let form = event.target;
22 dispatch({type: "newComment",
23 talk: talk.title,
24 message: form.elements.comment.value});
25 form.reset();
26 }
27 }, elt("input", {type: "text", name: "comment"}), " ",
28 elt("button", {type: "submit"}, "Add comment")));
29 this.syncState(talk);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected