3
I wanted to add the class tab-active
to all the tags span
of the div menuMobileTabs
. What’s wrong with it?
<div id='menuMobileTabs'>
<span>Sidebar</span>
<span>RedeSociais</span>
<span>Menu</span>
<span>Search</span>
</div>
<script>
var menuTabs = document.querySelector('#menuMobileTabs span');
for(var i = 0;i < menuTabs.length;i++){
menuTabs[i].classList.add('tab-active');
}
</script>
Ready. Ta ai! CDATA is because I use blogger.
– Ericki
Greatly improved with the code, makes it much easier for those who will test.
– Bacco