I am creating an App for iPhone using JavaScript. I have an array of images, let say img[] ,and a place all these images on screen i want to add action listener to each image. Each image has to perform different functionality. I am using this method
This method add action listener to images.Please tell me that this method is right or not. If yes then how can i identify that which image is clicked(it should tell me the index).
Code:
for(var i=0;i<img.length) { img[i].addactionlistner('click',function(e){ //Print the index of image clicked }); }
Comment