CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   Can I use jQuery to replace an image (http://www.codingforums.com/showthread.php?t=283469)

m2244 12-03-2012 03:35 PM

Can I use jQuery to replace an image
 
Hello,

As the title says I am trying to replace an image on the page with another image. It appears to be working but I believe that the old image is still there. Is there a better way to do this? Should I remove the old image before I add the new one?

Code:

$(".bannerImage").css('background-image','url("course_assets/banner_grey.png")');
Code:

.bannerImage{
        background:url('../course_assets/banner.png')no-repeat;
        height: 88px;
        width: 100%;
}


felgall 12-03-2012 06:35 PM

If that's the only script on your page then a better way would be to forget about jQuery and use a single JavaScript statement in place of the entire library.


All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.