getaway
getaway

Reputation: 8990

Changing background image using jquery

I have this jquery code that changes the image of the background on click:

$('a.note').click(function(){
  $('#full').css('background-image','img/1.jpg');

});

However, it's not changing. Is there something I'm missing?

Upvotes: 24

Views: 65682

Answers (1)

user113716
user113716

Reputation: 322592

You need to include the url() part of the background-image property.

$('#full').css('background-image','url(img/1.jpg)');

Upvotes: 46

Related Questions