In my html files I have divs that look like this:
- <div id="country-holder-denmark" imgGroup="group1"></div>
- <div id="country-holder-germany" imgGroup="group2"></div>
- ...
Then in my js file I have the following. The Array hold the ids of divs above, which are in my page.
- MyClientNameProject.prototype.init = function() {
- this.hitArray = new Array("#country-holder-denmark", "#country-holder-germany", "#country-holder-hungary", "#country-holder-russia", "#country-holder-austria");
- for(var i = 0; i < this.hitArray.length; i++) {
-
- $( this.hitArray[i] ).click(function() {
- alert('What image group to open: ' + $(event.target).attr('imgGroup') );
- });
- }
- }
In my alert(line 6) I can't seem to get the value of imgGroup. All I get is [object Object].
How can I get the values, like group1, group2, etc?
Thanks a lot for any help with this!!!