Difference between getelementbyid and getelementsbyname in javascript
Answers
Answered by
2
Answer:
There may be many elements on a page with the same name (hence getElementsByName always returns a list of elements), but there is (must) only be one element with a given id (therefore getElementById only returns a single element). The name attribute is not designed to be unique, while the id attribute is.
Similar questions