[jQuery] Re: Change image attribute based on variable

2009-02-26 Thread digital
Thanks, I ended up playing around with the url before I passed it into the function, didn't realise I could do it like that. On Feb 25, 7:49 pm, brian wrote: > Also, $($finalurl) likely won't select anything because you're only > passing the classname. It needs to be in the form '.classname' > (

[jQuery] Re: Change image attribute based on variable

2009-02-26 Thread digital
Thank you very much. It took me another hour but I managed to debug the code and get it all working, thanks again. On Feb 25, 7:38 pm, Stephan Veigl wrote: > Hi, > > instead of doing a complicate string handling you could simply use > window.location.hash: > > $finalurl = window.location.hash;

[jQuery] Re: Change image attribute based on variable

2009-02-25 Thread brian
Also, $($finalurl) likely won't select anything because you're only passing the classname. It needs to be in the form '.classname' (prepended by a dot). Try $('.'+$finalurl) On Wed, Feb 25, 2009 at 2:38 PM, Stephan Veigl wrote: > > Hi, > > instead of doing a complicate string handling you could

[jQuery] Re: Change image attribute based on variable

2009-02-25 Thread Stephan Veigl
Hi, instead of doing a complicate string handling you could simply use window.location.hash: $finalurl = window.location.hash; For debugging I would do it step by step and not all in one line: var el = $($finalurl+" :first"); var src = el.attr("src"); var src_split = src.split("."); var new_sr