Solved

Make second div with id "frame" invisible

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
popup load of page and setting up of session 8 42
jquery auto complete 11 20
Question about JQuery and asp.net 3 30
AJAX Wordpress Not Reading Variable 2 26
I have answered several questions lately that were solved utilizing the power of jQuery's AJAX functions, so I thought I would write an article demonstrating the ease of use. Why should I use jQuery as opposed to regular JavaScript? Now I know…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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…

789 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