Labrador-retriever | First experience of creating a site on HTML | Static Site Generator library
kandi X-RAY | Labrador-retriever Summary
kandi X-RAY | Labrador-retriever Summary
First experience of creating a site on HTML.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Labrador-retriever
Labrador-retriever Key Features
Labrador-retriever Examples and Code Snippets
Community Discussions
Trending Discussions on Labrador-retriever
QUESTION
I have a grid of images on an HTML page, and I'm trying to create an alert with the name of the image file when clicking on it. I am pulling images from a python script in an array urls
Below is my HTML code, including the relevant JS section. I have tried without passing any variables to the function (using alert(document.src)
) but clicking the image gives 'Undefined' in an alert. I have also tried passing a variable into the function and calling that in my alert, but that displays '[object MouseEvent]'.
What do I change in my function to display the original image file name, and is there a way to add flexibility to the function so that the same function is run regardless of which image is clicked, rather than repeat the same function for all four images?
...ANSWER
Answered 2020-Jun-23 at 14:40You can use this.src
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Labrador-retriever
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page