What is the difference between id and name attributes in HTML?

JavascriptWeb DevelopmentFront End Scripts

ID

The ID of a form Element nothing to do just an identification and nothing to do with the data contained within the element. The IDs are attached in writing and using in Javascript and CSS.

Referened with JS method getElementByID()

Name

The NAME attribute is used in the HTTP request sent by browser to the server as a variable name and it is associated with the data contained in the value attribute. We 

Cannot be referenced in CSS or any URL

Referenced with JS method getElementByName()

raja
Published on 22-Apr-2018 19:10:16
Advertisements