• Post Reply Bookmark Topic Watch Topic
  • New Topic

Add Action listener

 
asif Bashir
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

for(var i=0;i<img.length)
{
img[i].addactionlistner('click',function(e){
//Print the index of image clicked
});


}
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).
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are creating a native iOS app using JavaScript?

Any way, is the method you are using is correct or not? Try it!
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!