Difference between id and name attributes in HTML

前端 未结 19 3168
感动是毒
感动是毒 2020-11-22 05:17

What is the difference between the id and name attributes? They both seem to serve the same purpose of providing an identifier.

I would lik

19条回答
  •  萌比男神i
    2020-11-22 05:39

    Below is an interesting use of the id attribute. It is used within the tag and used to identify the form for elements outside of the boundaries so that they will be included with the other fields within the form.

     
    First name:

    The "Last name" field below is outside the form element, but still part of the form.

    Last name:

提交回复
热议问题