Listener set up to form and default skipped

Signed-off-by: Eoghan Conlon <eoghanconlon73@skynet.ie>
This commit is contained in:
eoghanconlon73 2023-08-27 21:14:23 +01:00
parent b3531da019
commit 6ba509f8bd

View file

@ -20,5 +20,14 @@
<script> <script>
document.getElementById('year').textContent = new Date().getFullYear().toString() document.getElementById('year').textContent = new Date().getFullYear().toString()
</script> </script>
<script>
const formEl = document.getElementById("form");
formEl.addEventListener('submit', formHandler);
function formHandler(listener){
listener.preventDefault();
alert("Default skipped");
}
</script>
</body> </body>
</html> </html>