Skip to content
Advertisement

I need help to overwrite images on html page upon clicking a button [closed]

I have stored my images in an array called arr I have put a button on the html page called ‘Next’ so that whenever the user clicks the next button,the next image is picked up and overwrites the previous one the issue is the image on html page does not get overwritten by the next image( stored in the array),so how do I accomplish this

please help me as I am new to javascipt.

JavaScript

Advertisement

Answer

I pretty much just cleaned up the code and had a variable that is the indicator to which picture comes up on the array and its loops. Also, I made the script tag defer so the tag loads after the whole page is so the function runs

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement