Pressing the button changes the background color of the paragraphs. javascript 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>