It will throw an error, because none of the elements in those queries exist. If you don‘t know if the elements exist or not, you will require to wrap all the code in conditions or use optional ...
document.getElementById(id) - Selects an element by its ID. document.getElementsByClassName(className) - Selects elements by their class name. document.getElementsByTagName(tagName) - Selects elements ...
Some results have been hidden because they may be inaccessible to you
Show inaccessible results