How can I execute a function when the user submits a form using an external JavaScript file?
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>example</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script type="text/javascript" src="main.js"></script>
</head>
<body>
<h1 class="title">example</h1>
<form onsubmit="a()">
<input type="text" class="input1" name="verb" id="verb" placeholder="Verb"/>
</form>
</body>
</html>
main.js
function a(){
alert("Submitting Form");
}