I am working on a project and I am having difficulty writing out the code I need to make the ball in my project change to the same color as the button in the top left hand corner when I change the color. I need them to be in sync. A few things to keep in mind this is without jquery pure vanilla javascript and ecma 5
With that being said here are the instructions for the project:
Use Javascript form events to adjust the background colour of a circle on the screen.
- Fork this repository.
- **Make a
<form>tag with an<input>inside it—usetype="color"for the input.- When the form’s
changeevent fires, adjust thebackground-colorof the ball to match the input’s value.- Run it through Markbot and make sure it passes all the checks.
Here is what my project currently looks like:
When I click on the button in the top left hand corner this pops up:
Here is my html:
<!DOCTYPE html> <html> <head> <title>CircleColourr</title> <link href="main.css" rel="stylesheet"> </head> <body> <div class="ball"></div> </body> <script src="jquery.min.js"></script> <script src="main.js"></script> </html> Here is my main.css
html{ box-sizing: border-box; } *, *::before, *::after{ box-sizing: inherit; } .ball{ width: 200px; height: 200px; position: absolute; top: 200px; left: 200px; background-color: ; border-radius: 100px; } Here is my main.js
var body = document.querySelector('body'); var h2 = document.createElement('h3'); var forma = document.createElement('form'); var inForma = document.createElement('input'); var h2 = document.createTextNode('Colour'); inForma.type = 'color'; inForma.id = 'listen'; body.appendChild(h2); forma.appendChild(inForma); body.appendChild(forma); var bally = document.querySelector('.ball'); bally.style.backgroundColor = forma; // first attempt console.log(bally.style.backgroundColor = forma);//first attempt var button = document.getElementById('listen').addEventListener ('click', change); function change(e){ document.querySelector('.ball').style.backgroundColor = forma; } I have made two attempts the first one just assigns the actual form element to the ball div and the second one nothing appears to be happening. The thought process for me was to assign the forma to the backgroundColor of the ball. I just need some guidance please.

