how do I put a variable inside an attribute for an href tag
Posted
by Ido
on Stack Overflow
See other posts from Stack Overflow
or by Ido
Published on 2010-05-04T17:26:44Z
Indexed on
2010/05/04
17:28 UTC
Read the original article
Hit count: 315
jquery-plugins
Hi I'm new to scripting
Trying to change the css acording to a url variable, using jqURL plugin. for some reason this does not work for me:
$(function(){
var n= $.jqURL.qs();
alert(n)
$("link[rel=stylesheet]").attr({href : 'n + ".css"'});
});
the alert is there for debug, and works well, so it is a matter of how i put the var in the attribute.
this, for example, works fine:
if(n == 'red') {
$("link[rel=stylesheet]").attr({href : "red.css"});}
help please
© Stack Overflow or respective owner