Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

document.getElementById('foo').style.display = 'none'; FOR classes

Posted on 2006-06-25
6
Medium Priority
?
1,782 Views
Last Modified: 2012-06-22
How can I do something like:

document.getElementById('foo').style.display = 'none';
but for classes:

eg.
<div class="foo">bar</div>
0
Comment
Question by:mnb93
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 6

Expert Comment

by:pD_EO
ID: 16978220
Changing the class?

<div class="foo" id="foo">bar</div>

document.getElementById("foo").className = "yar";
0
 
LVL 15

Accepted Solution

by:
justinbillig earned 1000 total points
ID: 16983400
I think what your looking for is here in this link


http://www.faqts.com/knowledge_base/view.phtml/aid/2147/fid/128


0
 
LVL 4

Expert Comment

by:FSIFM
ID: 16984330
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.
0
 
LVL 15

Expert Comment

by:justinbillig
ID: 16984378
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
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question