I am trying to set a background image for a button through html by using the following line:
<button> id="Flower" type="button" src="Images/Roses"></button>
Then I would like to be able to change its image by clicking another button to store an image file in an array (the array is needed because I want to store multiple images in an array to change multiple button background images) in java script by creating a function:
let images = [ ]
function insert(images) {
images.push(images)
document.getElementByID("Flower).src = Images[0]
}
In HTML another button would have the function as the onlclick:
<button type="button" onclick="insert(Images/Tulips)"></button>
It seems like I cant use an image file location as a parameter in a function. Is that correct?