1<!--Answer from W3 Schools-->
2<form action="/action_page.php">
3 <label for="username">Username:</label>
4 <input type="text" id="username" name="username" required>
5 <input type="submit">
6</form>
1<!-- use onsubmit -->
2<form onsubmit="return yourJavaScript(this)">
3 <div>
4 <label>Name:</label>
5 <input id="name" name="name" type="text">
6 </div>
7 <div>
8 <label>Email:</label>
9 <input id="email" name="email" type="email">
10 </div>
11 <div>
12 <input id="submit" type="submit">
13 </div>
14</form>