About HTML name and Id,form input without an associated label or title attribute

Source: Internet
Author: User

This is not a mistake, it is recommended to label the corresponding form element with the UX convenience. For example, the Name field:

Then give an example

<label for= "name" >nazwa:</label><textarea class= "Form-control" id= "name" Name= "NewTodo" Data-ng-model= "Formdata.newtodo" required></textarea>

Make the label's for point to the ID of input, so that when you click the label, input gets the focus.

What about the relationship between name and ID?

ID is like a person's ID number, and name is like his name, the ID is obviously unique, and name can be duplicated.

The following can only be used with name:

1. The control name of the form (form), and the submitted data is controlled by the control's name instead of the ID.

Because there are many name that correspond to multiple controls at the same time, such as checkbox and radio, the ID must be unique in the full-text file. In addition, the browser sets the request sent to the server according to the name. Therefore, if the ID is used, the server cannot get the data.

2. The name of frame and window for assigning target to another frame or window.

The following can only be used with ID:

1. label associated with form control, My InputThe For property specifies the ID of the element associated with the label and is not substituted with name.

2. CSS element selection mechanism,

About HTML name and Id,form input without an associated label or title attribute

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.