Allow your page background color change depending on the time of the day by this simple javascript. Next, let’s modify the function to allow both three and six-character colors. Try and test HTML code online in a simple and easy way using our free HTML editor and see the results in real-time. ; You never call backgroundColor() so your listener never gets added. To set the background color using jQuery, use the jQuery css() property. While this code still works, a more modern way to accomplish the aims of this page is shown in changing background color with style. To do that, we’ll first check the length of hexcolor.If it’s 3, we’ll use Array.split() to convert the hexcolor string into an array of characters. When written between