How can I change background color with jQuery .click(function(){
div normal with Green color, when clicked change to red background color
<div class="stileone">
Div Content
</div>
Use HTML DOM Style backgroundColor Property to change the background color after clicking the button. This property is used to set the background-color of an element. Example: This example changes the background color with the help of JavaScript.
$(".stileone").on("click", function() {
$(this).css("background", "red");
})
DEMO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With