Getelementbyclassname() - Is Not A Function
I expected the code below to change Random1 and Random2 to Random but its not doing anything. When I checked developers tool in chrome, it showed 'document.getElementByClassName is
Solution 1:
You should use getElementsByClassName
instead using getElementByClassName. It seems you misspelled.
Solution 2:
It seems to be an undefined function you used to call
The class based selection returns an array of objects which is because of multiple elemnts have same class so the function should be getElementsByClassName
instead you used getElementByClassName
If it is for Id selector getElementById
is enough because there is only instance might be there in the DOM
Post a Comment for "Getelementbyclassname() - Is Not A Function"