AbidingDude
Programmer
I've been away from JS for a while. I'm getting back into it for a project. The last time I remember working on something form-related. I remember reading back then that the getElementsByName() method was deprecated for everything except forms.
I go back to w3schools today to refresh my memory, and it says the "name" attribute is deprecated and to use the "id" attribute instead:
[URL unfurl="true"]https://www.w3schools.com/jsref/met_doc_getelementsbyname.asp[/url]
That sounds like it's deprecated for all instances. That sounded a little extreme so I also checked out the Mozilla Developer site:
[URL unfurl="true"]https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName[/url]
They mention that it can only be used in XHTML documents.
Is the "name" attribute still valid for forms?
I go back to w3schools today to refresh my memory, and it says the "name" attribute is deprecated and to use the "id" attribute instead:
[URL unfurl="true"]https://www.w3schools.com/jsref/met_doc_getelementsbyname.asp[/url]
That sounds like it's deprecated for all instances. That sounded a little extreme so I also checked out the Mozilla Developer site:
[URL unfurl="true"]https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName[/url]
They mention that it can only be used in XHTML documents.
Is the "name" attribute still valid for forms?