--- title: GlobalEventHandlers.onsubmit slug: Web/API/GlobalEventHandlers/onsubmit tags: - API - HTML DOM - 레퍼런스 - 속성 translation_of: Web/API/GlobalEventHandlers/onsubmit ---
현재 창에서 폼을 제출하는 이벤트를 다루는 이벤트 핸들러
window.onsubmit = funcRef;
funcRef 는 함수를 참조하는 변수이다.<html>
<script>
function reg() {
window.captureEvents(Event.SUBMIT);
window.onsubmit = hit;
}
function hit() {
console.log('hit');
}
</script>
<body onload="reg();">
<form>
<input type="submit" value="submit" />
</form>
<div id="d"> </div>
</body>
</html>
제출 이벤트는 사용자가 폼 내부에 있는 제출 버튼(<input type="submit"/>)을 눌렀을 때 발생한다.
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('HTML WHATWG','webappapis.html#handler-onsubmit','onsubmit')}} | {{Spec2('HTML WHATWG')}} |