javascript html input name code example
Example 1: html input name
<form action="/action_page.php">
<label for="fname">First name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
Example 2: how to get input name in javascript
// Using jQuery:
$('#id').attr('name');
// Using vanilla js:
let name=document.getElementById("id").name;