Tuesday, June 28, 2011

Difference Between document.getElementByID() & document.getElementsByName()

In Javascript, Its common that most of us get confused at times, when it comes to document.getElementByID() & document.getElementsByName().

(Note : Its document.getElementsByName())

The difference between the two is that, document.getElementByID() returns the specified object whereas document.getElementsByName() returns the array of the objects having the same name.

Example is below :

1 comment:

  1. nice 1. I have found another article for the same, have a look at http://www.etechpulse.com/2013/08/difference-between-documentgetelementsb.html