html change background color on click code example
Example 1: html change background color
<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">
</body>
</html>
Example 2: html change background color of page
<body bgcolor="some color">
HTML goes here
</body>
Example 3: 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>