![]() |
Definition and Usage
The Applies to
The
Browser Support
|
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<p>When you submit the form, a function is triggered which alerts some text.</p>
<form action="/action_page.php" onsubmit="myFunction()"> Enter name: <input type="text" name="fname"> <input type="submit" value="Submit">
</form>
<script>
function myFunction() { alert("The form was submitted");
}
</script>
</body>
</html>
html onsubmit attribute |
How to Execute a JavaScript when a form is submitted - HTML onsubmit Attribute | HTML Attribute |
Type
: |
Develop |
Category
: |
Web Tutorial |
Sub Category
: |
HTML Attribute |
Uploaded by
: |
Admin |
Read Article https://horje.com/learn/1434/reference