Change Div Background Color Style

JavaScript Change background-color style functionality can be created by using JavaScript DOM style properties. In this sample backgroundColor  property of style object of JavaScript DOM has been used to change the background color of the HTML element.

JavaScript Dom Features Used

1. document object

2. getElementsById method

3. style object

4. BackgroundColor property

Try the sample below to learn and practice the JavaScript DOM code for developing this functionality:

Edit this code and click update to view output
OUTPUT:
  • HIRE EzineASP.Net Developers