Reputation: 53
https://jsfiddle.net/dhaileytaha/ghuj4jL8/1/
The above is a fiddle in which i want to toggle or show/hide the background image(i.e. tick mark) onclick
and also select the following offer in database (mysql)
. I am able to show the tick mark but not hide it. Please help.
$(function() {
$('.listing-content').click(function() {
$(this).css('background-image', 'url(https://i.sstatic.net/Kg1Do.png)');
});
})
Upvotes: 0
Views: 109
Reputation: 518
Here you can use addClass and remove Class method.
you can write a class called "tickMark" in that you give background-image property and you add the class and remove the class dynamically.
https://jsfiddle.net/ghuj4jL8/4/
Upvotes: 0