function myFunction(input){ var number_of_images = input.parentNode.getElementsByTagName("img") var image_clicked = number_of_images.indexOf(input) alert ("you clicked on image number "+image_clicked) }
I am building a rating scale with three images. I want to tell the user which of the three images he clicked. I have onClick events on all three onClick images (this). Then I try to use indexOf (input), where input refers to the (this) parameter passed from onclick (this). This does not work. ยฟCan any alternative be offered? Thanks.
source share