Make second div with id "frame" invisible

If the rendered HTML has 2 div tags with id="frame" - how do I make *just* the second div invisible?
LVL 5
Tom KnowltonWeb developerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GaryConnect With a Mentor Commented:
You don't because ID's are supposed to be unique.
If you want to use the same name then use classes.
0
 
Tom KnowltonWeb developerAuthor Commented:
$('div[id*="frame"]:eq(1)').css('display', 'none');

??

But I get what you are saying.
0
 
Chris StanyonCommented:
@knowlton - listen to Gary - IDs are unique. If they're not, then you need to change your code, rather than hacking your script!
0
 
GaryCommented:
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
 
Tom KnowltonWeb developerAuthor Commented:
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
All Courses

From novice to tech pro — start learning today.