JSFiddle - React, Tailwind, and code Playground
by ChrisStanyon
HTML
<img src="https://dummyimage.com/100x100/000/f00" class="gall">
<img src="https://dummyimage.com/100x100/000/0f0">
<div id="container" class="row">
<img src="test.png">
<img src="https://dummyimage.com/100x100/000/00f">
</div>
JavaScript
document.querySelectorAll('img.gall').forEach((img) => {
img.addEventListener('mouseover', function() {
let filename = new URL(this.src).pathname.split("/").pop();
console.log(filename)
})
})
/* document.getElementById('myImg').onmouseover = function(e) {
console.log(this.src)
} */