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

JavascriptWeb DevelopmentFront End Scripts


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()


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()

Updated on 30-Jul-2019 22:30:22