Answers for "html change background color on click"

2

html change background color of page

<body bgcolor="some color">
 HTML goes here
</body>
Posted by: Guest on July-30-2020
1

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>
Posted by: Guest on March-17-2021

Code answers related to "html change background color on click"

Browse Popular Code Answers by Language