Could someone go into the history/reasons why interacting with form elements using the NAME has gone out of practice and document.getElementById has taken over.
What exactly historically happened that prompted this change and shift.
And finally, has there been a shift or are both still recommended ways of doing things?
Document.getElementById vs  document.form.name
According to some forum discussions document.form.name is not recognized by all browsers. Is this the case? See:
"I've been told in the past that you should not use "document.form_name.element_name" compared to "document.getElementById()", as the first is not recognized by all browsers. "
The property NAME is not necessarily unique. For example, radio buttons are grouped by having the same name. Calling getElementByName would return all buttons in the set. ID is meant to be unique. So, to answer your question, each has their place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With