[jQuery] Re: Checking value

2009-07-08 Thread mkmanning

FYI this:

if ('http://example.com/foo/bar.html' === $('a', $(this)).attr
('href')) {
alert('Hooray!');
}

is the same as your original code, except for the full url.


On Jul 8, 3:25 am, "brightdad...@googlemail.com"
 wrote:
> Yes it worked!
>
> On Jul 8, 10:09 am, "brightdad...@googlemail.com"
>
>
>
>  wrote:
> > Hi Experts,
>
> > I am trying to conditionally test what the value of href is equal to.
>
> > like this;
>
> > if($(this).find('a').attr("href")=="map.html"){
> >  alert("yes");
>
> > }
>
> > This doesn't work. Do anyone knows what i am doing wrong.
>
> > Psuedocode please.


[jQuery] Re: Checking value

2009-07-08 Thread brightdad...@googlemail.com

Yes it worked!

On Jul 8, 10:09 am, "brightdad...@googlemail.com"
 wrote:
> Hi Experts,
>
> I am trying to conditionally test what the value of href is equal to.
>
> like this;
>
> if($(this).find('a').attr("href")=="map.html"){
>  alert("yes");
>
> }
>
> This doesn't work. Do anyone knows what i am doing wrong.
>
> Psuedocode please.


[jQuery] Re: Checking value

2009-07-08 Thread Massimo Lombardo

I don't know if it'll work 'cause you didn't post any XHTML, but you
could give this try:

if ('http://example.com/foo/bar.html' === $('a', $(this)).attr('href')) {
alert('Hooray!');
}

PS: avoid using == and !=, instead use === and !==

On Wed, Jul 8, 2009 at 11:09,
brightdad...@googlemail.com wrote:
>
> Hi Experts,
>
> I am trying to conditionally test what the value of href is equal to.
>
> like this;
>
> if($(this).find('a').attr("href")=="map.html"){
>  alert("yes");
> }
>
> This doesn't work. Do anyone knows what i am doing wrong.
>
> Psuedocode please.
-- 
Massimo Lombardo
Linux user #437712