Solved

Make second div with id "frame" invisible

Posted on 2013-05-15
5
287 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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn how to dynamically set the form action using jQuery.
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…

733 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