Change background color on button click in javascript

Change background color on button click in javascript is a good example of DOM manipulation.

You can change the background color of any element like div, paragraph or can change the color of the HTML body.

To change the background color we use style property.

Let us see one by one

Changing the background color of the HTML element

Changing the background color of the body