[jQuery] Re: Variable in selector
try this: $(function() { $('"#' + imgToShow + '"').hide(); }) -Original Message- From: andreas [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 11, 2007 3:19 PM To: jquery-en Cc: andreas Subject: [jQuery] Variable in selector I'm trying to hide an image, and I have the id of that image in a variable (imgToShow). Here's what I'm trying: $("#"+imgToShow).show(); This is not working. What am I doing wrong?
[jQuery] Re: Variable in selector
That unfortunately hides the whole page. It goes completely blank in both FF and IE7. :-( On Apr 11, 9:44 am, [EMAIL PROTECTED] wrote: > [BDY.TXT]try this: > > $(function() { > $('"#' + imgToShow + '"').hide(); > > }) > -Original Message- > From: andreas [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 11, 2007 3:19 PM > To: jquery-en > > Cc: andreas > Subject: [jQuery] Variable in selector > > I'm trying to hide an image, and I have the id of that image in a > variable (imgToShow). Here's what I'm trying: > > $("#"+imgToShow).show(); > > This is not working. What am I doing wrong?
[jQuery] Re: Variable in selector
Don't worry about this. My original code does work, but there was a css rule the interfeared. Thanks for the help! On Apr 11, 12:12 pm, "Oddish" <[EMAIL PROTECTED]> wrote: > That unfortunately hides the whole page. It goes completely blank in > both FF and IE7. :-( > > On Apr 11, 9:44 am, [EMAIL PROTECTED] wrote: > > > [BDY.TXT]try this: > > > $(function() { > > $('"#' + imgToShow + '"').hide(); > > > }) > > -Original Message- > > From: andreas [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, April 11, 2007 3:19 PM > > To: jquery-en > > > Cc: andreas > > Subject: [jQuery] Variable in selector > > > I'm trying to hide an image, and I have the id of that image in a > > variable (imgToShow). Here's what I'm trying: > > > $("#"+imgToShow).show(); > > > This is not working. What am I doing wrong?