Solved

Make second div with id "frame" invisible

Posted on 2013-05-15
5
276 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 42

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

by Julian Matz As of jQuery (http://jquery.com/) 1.4 the .live() method (http://api.jquery.com/live/) supports custom events as well as some standard JavaScript events that it previously didn't support. Among these is the submit event. Unlike …
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 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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now