I have created this statement and it does its job but not very efficient.
How can I put this in a loop and populate the information that I want anonymously? I do not want to copy and paste this for every (id) there is on this page.
Locate id get value and use same value to change the bgColor of the page
Your help will be much appreciated! Thanks!
How can I put this in a loop and populate the information that I want anonymously? I do not want to copy and paste this for every (id) there is on this page.
Locate id get value and use same value to change the bgColor of the page
Code:
<input id="red" value="red">red <input id="green" value="green">green <script> document.getElementById('red').addEventListener('click', function (e) { inputColor = e.target.getAttribute('value'); document.bgColor = inputColor; }, true); <script>
Comment