Question:I’m trying to make an simple Tab Gallery based on the one found at W3Schools.
However I want to be able to use a relative image path instead of using ‘this’ when calling myFunction. But I don’t know how to do that.
As you can see in the Html, I have tried using a relative path for the second image, which doesn’t work. My structure is, index.html + main.css + script.js are all in the same folder and then I have a folder called ‘img’ for the images.
Answer:using “this” is easier and shorter than use relative path but if you still want please try this:
If you have better answer, please add a comment about this, thank you!