Question

i have 3 images with the same id="UserImages" i wanted to know if i can click on them and get the scr in jquery?

Was it helpful?

Solution

First I'd switch them to classes (IDs must be unqiue):

<img class="UserImages" src="..." />

Then use a .class selector to find them, like this:

$("img.UserImages").click(function() {
  alert(this.src);
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top