Reputation: 4867
I have some span
tag with let's say #span
id that has the property background: url(some image) -22px top no-repeat
, which displays some image as a background.
If it has the property background: url(some image) -22px top no-repeat
, another image is displayed. The problem is that if I specify ('#span').attr('background-position','0px top')
nothing happens, the other image is not displayed. Could someone explain why?
Upvotes: 0
Views: 2803
Reputation: 57105
Use .css()
$('#span').css('background-position','0px top');
.css() -> Get the value of style properties for the first element in the set of matched elements.
Upvotes: 1