[jQuery] Re: trying to add a 'class' to a link based on the value of the link's href

2009-03-15 Thread mkmanning
You could have an issue with the ondomready code executing before you're included file builds the navigation, depending upon how you're including it. I'd suggest using Firebug for Firefox instead of the alert() and adding console.log() in your code to make sure you've actually got the DOM you thin

[jQuery] Re: trying to add a 'class' to a link based on the value of the link's href

2009-03-15 Thread vintagetwitch
Hmmm... Still no luck. I suspect this has more to do with me. Also to give a little background, I have 40 html pages that I'm using a jquery styleswitcher script on to be able to switch between 4 different font treatments. I am generated the nav html with Javascript like this if that makes any d

[jQuery] Re: trying to add a 'class' to a link based on the value of the link's href

2009-03-12 Thread mkmanning
Last time :( You need the a variable as a jQuery object to call the addClass() method The a[0].href gets the href (duh), or you could use a.attr('href') var file = jQuery.url.attr("file"); alert(file); $('.design_html_nav li').each(function(){ var a = $(thi

[jQuery] Re: trying to add a 'class' to a link based on the value of the link's href

2009-03-12 Thread mkmanning
Sorry, it should just be if(a===file){.. the var 'a' is already the href. On Mar 12, 8:15 am, vintagetwitch wrote: > Thanks for your response, and my apologies for the double post. > So now, this is what I have, and for some reason, now I'm not able to > extract any values from the array of ta

[jQuery] Re: trying to add a 'class' to a link based on the value of the link's href

2009-03-12 Thread vintagetwitch
Thanks for your response, and my apologies for the double post. So now, this is what I have, and for some reason, now I'm not able to extract any values from the array of tags, even with an alert. Don't I need to loop through them to see if 'a === file'. var file = jQuery.url.attr("file");

[jQuery] Re: trying to add a 'class' to a link based on the value of the link's href

2009-03-11 Thread mkmanning
Deja Vu :) Why use a separate array? $('.design_html_nav li').each(function(){ var a = $(this).find('a').attr('href'); if(a[0].href===file){ a.addClass('selected'); } }); On Mar 11, 3:36 pm, ksandn...@gmail.com wrote: > Hi there, > > What I'm trying to do