?
Solved

Make second div with id "frame" invisible

Posted on 2013-05-15
5
Medium Priority
?
293 Views
Last Modified: 2013-05-15
If the rendered HTML has 2 div tags with id="frame" - how do I make *just* the second div invisible?
0
Comment
Question by:Tom Knowlton
[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
  • 2
5 Comments
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 39169082
You don't because ID's are supposed to be unique.
If you want to use the same name then use classes.
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 39169523
$('div[id*="frame"]:eq(1)').css('display', 'none');

??

But I get what you are saying.
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 39169546
@knowlton - listen to Gary - IDs are unique. If they're not, then you need to change your code, rather than hacking your script!
0
 
LVL 58

Expert Comment

by:Gary
ID: 39169569
Even hacking the code cannot be relied on to work as generally where another element with the same id is found then the id is ignored completely.
0
 
LVL 5

Author Comment

by:Tom Knowlton
ID: 39169571
Understood.

All of our controls have a 'skeleton' <div> framework that they use.

In other words - every control has a div with id="frame"

So when two controls are on the same page, you get two sets of divs with id="frame"


The CSS that gets applied is based on having a "div" with id="frame".  It is not based on having a class get applied.

Otherwise I would just change the id to something else.


A long-winded way of agreeing with both of you.  : )
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
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…
Suggested Courses

771 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