Reputation: 1279
How to change background img with jquery by clicking on button?
My code does not work.
$(document).ready(function(){
$("#go").click(function() {
$('body').css("background-image", "url(blue_bg.jpg)");
};
});
Upvotes: 0
Views: 169
Reputation: 3246
try fixing like this and see if works:
$(document).ready(function(){
$("#go").click(function() {
$('body').css("background-image", "url(blue_bg.jpg)");
}); // you forgot to close the click event
});
Upvotes: 8