Reputation: 6189
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?
Upvotes: 1
Views: 336
Reputation: 630349
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);
});
Upvotes: 8