Learn JavaScript Free PDF Guide Source code 6 exercises included

DOM create Page elements adding style

Create interactive elements that can store the current color value input an array, for later use.  Also creates buttons to update the body background color to the value of the button text.  Color style and events with Dynamic Elements DOM.

Page elements Events and Style Exercise :

  1. Using JavaScript create two buttons on the page.
  2. Add a click event to the first button, that when pressed should list out all the stored color values from the holding array.  When pressed create page elements that have the color value from the holding array, and are clickable elements.  Once clicked the element should be removed from the page.
  3. The second button should store the color value from the input field into a holding array.
  4. The second button should also create a page element button, that has the text content of the input field color value.
  5. On change of the input value update the background color to match the input field value.

Leave a Comment