querySelectorAll.style does not work

querySelector:

Returns the first element within the document…

querySelectorAll:

Returns a list of the elements within the document…

IE in the first one, you’re operating on a single element, which does have a style property. The second one is a list of elements, so you need to loop over that list applying the style:

var els = document.querySelectorAll("div#tabs" + tabId + "> div.page");
for (var x = 0; x < els.length; x++)
    els[x].style.display = 'none';

Leave a Comment