Solved

Make second div with id "frame" invisible

Posted on 2013-05-15
5
279 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:knowlton
  • 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: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: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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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)

912 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now