mnb93
asked on
document.getElementById('foo').style.display = 'none'; FOR classes
How can I do something like:
document.getElementById('f oo').style .display = 'none';
but for classes:
eg.
<div class="foo">bar</div>
document.getElementById('f
but for classes:
eg.
<div class="foo">bar</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
why dont you just assign id="foo" to the <div> tag.
e.g. <div id="foo">bar</div>
Instead of a class as classes are used for CSS.
e.g. <div id="foo">bar</div>
Instead of a class as classes are used for CSS.
well what I think he is trying to accomplish is .. there are multiple items that use the foo class, what he wants to do is programatically hide all items that have the foo class without having to iterate though all the items on the page
<div class="foo" id="foo">bar</div>
document.getElementById("f