[Solved] GetElementsByClassName Not Working As Expected [duplicate]

You are using getElementsByClass (it doesn’t exist) and changing property for the whole collection (not valid, you should iterate through Node list to change attribute’s value). You should do something like this : var n = document.getElementsByClassName(‘numrooms’) for(var i=0;i<n.length;i++){ n[i].disabled = true; } solved GetElementsByClassName Not Working As Expected [duplicate]

[Solved] What do querySelectorAll and getElementsBy* methods return?

Your getElementById code works since IDs have to be unique and thus the function always returns exactly one element (or null if none was found). However, the methods getElementsByClassName, getElementsByName, getElementsByTagName, and getElementsByTagNameNS return an iterable collection of elements. The method names provide the hint: getElement implies singular, whereas getElements implies plural. The method querySelector … Read more

[Solved] What do querySelectorAll and getElementsBy* methods return?

Your getElementById code works since IDs have to be unique and thus the function always returns exactly one element (or null if none was found). However, the methods getElementsByClassName, getElementsByName, getElementsByTagName, and getElementsByTagNameNS return an iterable collection of elements. The method names provide the hint: getElement implies singular, whereas getElements implies plural. The method querySelector … Read more