how to change background color of button on click using css code example
Example: change background color on button click in javascript
<style>
.bg1 {
background-color: red;
}
</style>
<button id="btnChangebgColor" />
<script>
$(document).ready(function(){
$("#btnChangebgColor").click(function() {
$(this).addClass(".bg1");
});
}
</script>