1

Is there a suggested naming convention for HTML form element IDs vs. the name attribute?

I am referring specifically to when submitting the form and using jQuery.serializeArrays() to capture the data which appears to give {"name":"", "value":""} pairs.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
weaveoftheride
  • 4,092
  • 8
  • 35
  • 53
  • I've raised the 'primarly opinion based' flag on your question pre-edit, but since it's now edited, it's more a duplicate of this one: http://stackoverflow.com/questions/1397592/difference-between-id-and-name-attributes-in-html – roberrrt-s Nov 15 '16 at 09:45
  • 3
    Hi @Roberrrt thanks for the reply. I have just read that question, but I'm interested not in the difference but in the naming and there seems to be conflicting answers. The primary point of the question is not about naming but that id is for DOM ident and name is for posting form data. – weaveoftheride Nov 15 '16 at 09:47

1 Answers1

-4

You can find Google's style guide here:

4.1.2 ID and Class Naming

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Paul
  • 42
  • 1
  • 6