What are these HTML form fields for?

I saw the code for the code, html, which looks like this:

<form name="form1" method="post" action="action.php">
    <label for="name"> Name: <input type="text" name="name">
    <label for="email">Email: <input type="text" name="email">
</form>

What is the name form? (-> form1)

What is the shortcut for? (I never use this, so I may be wrong when entering the code)

+3
source share
4 answers

Labels are fragments of text next to input fields - they do not look different than plain text, but:

  • clicking on them puts focus on the field
  • read them as a description of the corresponding field.

They are also useful for CSS - with labels you can easily create your own field labels independently of other page elements.

form name JavaScript ( id).

+6

- , . , - - , , , . , , - , . ,

<label for="name">Name:</label><input type="text" name="name" />
<label for="email">Email:</label><input type="text" name="email" />

label http://www.w3.org/TR/html401/interact/forms.html#h-17.9 - , HTML.

name javascript css, . http://www.w3.org/TR/html401/interact/forms.html#adef-name-FORM - id ( ).

+5

"Name:" , for. . w3c html documentation.

, , - .

+2

- , JavaScript. "id", .

label , "" "id" , , , .

, , , , , .

<label for="name">Name:</label><input id="name" type="text" name="name" />
+2

Source: https://habr.com/ru/post/1711243/


All Articles