GlobalEventHandlers.onsubmit
Baseline
Widely available
This feature is well established and works across many devices and browser versions. Itâs been available across browsers since 2015ë 7ì.
íì¬ ì°½ìì í¼ì ì ì¶íë ì´ë²¤í¸ë¥¼ ë¤ë£¨ë ì´ë²¤í¸ í¸ë¤ë¬
문ë²
js
window.onsubmit = funcRef;
ë§¤ê° ë³ì
funcRefë í¨ì를 참조íë ë³ìì´ë¤.
ìì
html
<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 |
|---|
| HTML > # event-submit > |
| HTML > # handler-onsubmit > |