Because this wasn't immediately obvious to me when I started out, here is why:
The jQuery selector will always return an object. Eg: typeof($("#doesntExist")) == "object". That means if( $("#doesntExist") ) will evaluate true. This is intentional - ie, if you do something like this: $("#doesntExist").hide() you won't get nasty js errors. Cheers, Hamish On Apr 23, 7:29 am, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Try doing > > if ( $('#specialSection').length ) > > in your conditional. > > -- Josh > > > > ----- Original Message ----- > From: "Sharique" <[EMAIL PROTECTED]> > To: "jQuery (English)" <jquery-en@googlegroups.com> > Sent: Tuesday, April 22, 2008 12:22 PM > Subject: [jQuery] searching css id > > > Hi, > > What I'm trying to is that when there is certain css id appears in > > area. then it should hide right sidebar and change the width of center > > area. > > > if($('#specialSection')) > > { > > $('#sidebar-right').hide(); > > $('#center').css('width','760px'); > > } > > > But this code is not working properly. It hides right sidebar on every > > page.- Hide quoted text - > > - Show quoted text -