Reputation: 21
i am trying to compare the value of background-image and do image that image to another one here is the snippet
if ($('.list').css("background-image") === "url(images/Remove.png"){
$('.list').click(function(){
$('.list').css({
'padding-left' : '40px',
'background-image' : 'url(images/Remove_vertical.png)',
'background-repeat' : 'no-repeat'
});
}
}
This is not working any suggestion
Upvotes: 2
Views: 4629
Reputation: 738
Your syntax is wrong.
if ($('.list').css("background-image") === "url(images/Remove.png"){
e.g. should look like
if ($('.list').css("background-image") === "url(images/Remove.png)") {
instead.
if ( $('.list').css("background-image") === "url(images/Remove.png)" )
{
$('.list').click(function()
{
$('.list').css({'padding-left' : '40px' ,
'background-image' : 'url(images/Remove_vertical.png)',
'background-repeat' : 'no-repeat'});
});
}
Upvotes: 4