Using Dojo To Programmaticaly Add A List Of Images And Add A Click Event For Each Of Them
I am loading a list of images and adding a click event to each of them using Dojo so when user clicks an image, the ID for that image gets displayed. Please see codes below. Images
Solution 1:
I would suggest to use dojo/array
instead of for loop. Also you should create your images at the beggining of your code. Then add them in an array and make a loop on that array in order to add them to the dom.
I am giving an example below but I am using paragraph tags instead of images for simplicity. You can do what I am doing on the example below but instead of creating paragraphs you can create images.
Example: https://jsfiddle.net/an90dr/493khnug/
Post a Comment for "Using Dojo To Programmaticaly Add A List Of Images And Add A Click Event For Each Of Them"