Created
May 17, 2020 15:42
-
-
Save theptrk/576fe3b5907104c4ca5dec619ea1c77f to your computer and use it in GitHub Desktop.
HTML onsubmit connected to javascript function using a todo list input example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello onsubmit</title> | |
</head> | |
<body> | |
<h1>Hello onsubmit</h1> | |
<form onsubmit="handleForm()"> | |
<input type="text" name="todo" autocomplete="off"> | |
<button type="submit">Create Todo</button> | |
</form> | |
<script type="text/javascript"> | |
function handleForm(e) { | |
console.log(e) | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This needs a prevent default