Use jQuery to change a CSS value

Posted by justSteve on Stack Overflow See other posts from Stack Overflow or by justSteve
Published on 2010-06-18T14:17:40Z Indexed on 2010/06/18 14:23 UTC
Read the original article Hit count: 194

Filed under:
|

If i have a background image defined as:

#header
{
    width: 100%;
    background: url(/Content/images/header.jpg) -0 0 no-repeat;
}

and i want to overwrite that after the page loads. Shouldn't this code work?

$("#header").css('background-image', '/Content/images/aff/header_<%=affiliateID%>.jpg')

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about css