0

I'm trying to dynamically hide a div when a dropdown menu is activated, I am using an applet on my site, and I'm running into problems with it covering the dropdown menu (as it's being drawn ontop of everything). I've been trying this code and variations thereof and to no avail. I'm using wordpress as a base for the site...

 $('#megaMenu ul.megaMenu > li.mega-with-sub > a').toggle( function(e){ e.preventDefault(); $('#gameContent').hide(); }, function(e){ e.preventDefault(); $('#gameContent').show(); } ); 

Hope someone can help me here, it'd be much appreciated, the site is:

http://www.nesowns.com

Thanks!

The associated HTML is:

<div align="center" style="display:none" id='gameContent'> <applet archive="http://www.nesowns.com/run/vNES_213.jar" code="vNES.class" height="480" width="512"> <param name="rom" value="xxxx" /> <param name="romsize" value="xxxx" /> </applet> </div> 
4
  • 3
    What is gameContent? Is it already a jQuery object? Commented May 3, 2011 at 15:25
  • Is gameContent a variable or the id of an element? In case of the second you'll have to define it like this $('#gameContent') Commented May 3, 2011 at 15:26
  • @JacobM There an error: Error: illegal character Source File: nesowns.com Line: 77, Column: 2 Source Code: $(#megaMenu ul.megaMenu > li.mega-with-sub > a).toggle(function(e){ Commented May 3, 2011 at 15:27
  • Looking at the code of your site it appears that you have fixed the problem, and that psynnott had the correct answer. Could you please accept his answer. Commented May 3, 2011 at 15:30

1 Answer 1

5

try:

$('#gameContent').show(); 

and the same for the hide line. This assumes that the div has 'gameContent' as the ID.

Sign up to request clarification or add additional context in comments.

8 Comments

Well that would depend on what game content is right? it could be gameContent, .gameContent or #gameContent, it depends.
Trufa, that's why I said "assumes that the div has ... as the ID" :)
Looks like it is an id if you check the source - <div align="center" style="display:none" id='gameContent'>
@psynnott: Ohh fair enough, I must admit I did not see you clarification and rushed to comment! lets see what the OP has to say.
@Stevaz looks like you're missing quotes around $(#megaMenu ul.megaMenu > li.mega-with-sub > a) judging by the source on the page
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.