In this section, we will learn what the name attribute is in HTML <input> element and how to use it.
What is name Attribute in HTML <input> Tag?
The name attribute in HTML <input> element is used to set a name for that element. This name can then later on be used to access the owner element via other programming languages like JavaScript and CSS in order to apply any necessary modifications.
Also, in servers we use the value set for the name attribute to get access to the value users entered to that input element.
HTML name Attribute in <input> Tag Syntax:
<input type = “type” name = “element-name”>
<input> Tag name Attribute Values
The value of the name attribute is any general or specific name (including numbers and characters). But you should always try to use those names that remind you of what element this name referring to.
Example: using name attribute in HTML <input> tag
See the Pen using name attribute in HTML <input> tag by Omid Dehghan (@odehghan) on CodePen.