Name Attribute

  • Valid only on a, form, iframe, img, map, input, select, textarea
  • Name does not have to be unique
  • Can not be referenced in CSS or URL
  • Is referenced in JS with getElementsByName()
  • Shares same name space as id attribute
  • Must begin with a letter
  • Is case sensitive
  • Used on form elements to submit information

Id Attribute

  • Valid on any element
  • Each Id should be unique
  • Can be used as anchor reference in URL
  • Is referenced in CSS or URL with # sign
  • Is referenced in JS with getElementById()
  • Shares same name space as name attribute
  • Must begin with a letter
  • Is case sensitive

http://stackoverflow.com/questions/7470268/html-input-name-vs-id

Name Attribute

  • Valid only on a, form, iframe, img, map, input, select, textarea
  • Name does not have to be unique
  • Can not be referenced in CSS or URL
  • Is referenced in JS with getElementsByName()
  • Shares same name space as id attribute
  • Must begin with a letter
  • Is case sensitive
  • Used on form elements to submit information

Id Attribute

  • Valid on any element
  • Each Id should be unique
  • Can be used as anchor reference in URL
  • Is referenced in CSS or URL with # sign
  • Is referenced in JS with getElementById()
  • Shares same name space as name attribute
  • Must begin with a letter
  • Is case sensitive

http://stackoverflow.com/questions/7470268/html-input-name-vs-id