17
When we create a tag in HTML we can assign values to its properties, however, the property id
and name
, I realize that they are widely used and generally the values that are assigned to them are the same, see the example below:
<!DOCTYPE HTML>
<html lang="pt-br">
<head>
<meta charset="UTF-8" />
<title>Exemplo para ilustração.</title>
</head>
<body>
<p size=2>O <spam style="font-weight:bolder;">input text</spam> esta com as propriedades id e name definidas com o mesmo valor<br> que é "nome".</p>
<label for="nome">Nome:</label><br>
<input type="text" name="nome" id="nome" size=25 />
</body>
</html>
What is the purpose of these two properties id
and name
and if there is any difference in relation to each other, since both hold the same value?
If you have any suggestions for improvement please leave a comment. This is not the first time this is happening with my questions.
– gato
Related: What is the need to maintain an attribute
name
on a tagHTML
?– user28595
But I think this one only partially answers the question.
– user28595