17th October 2022
The form
attribute
Did you know there is a form attribute you can use on your form elements like <input>
tags to identify which form they belong to? I just got to know this today.
Here is an example for context.
<form id="form1">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<input type="submit" value="Submit">
</form>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname" form="form1">