I’m looking at some jQuery because I want to create a div that changes color when you click it.
And I’ve done that with:
$(function() {
$('.star').click(function(){
$(this).css('background', 'yellow');
});
});
And it works perfectly!
But I want it to remove the background color, when you click it one more time. Is that possible, and how would you do something like that?
Create a CSS class:
and then simply toggle that class it via jQuery: