I have a query regarding implementing multiple toggles within a for loop. For instance, I want a toggle menu to appear when clicking on a div.
Here is the code snippet:
for (var i = 0; i < myObjectString.length; i++) {
var obj = JSON.parse(myObjectString);
document.getElementById("endorsment").innerHTML += "<div id='endor'>\n\
<div class='endo_"+ obj.Endorsment[i].lang + "' id='endo'>\n\
<div id='count'>"+ obj.Endorsment[i].ln + "</div>\n\
<div id='proglang'>"+ obj.Endorsment[i].lang +"</div>\n\
</div>\n\
<div class='contenthover_"+ obj.Endorsment[i].lang +"' id='contenthover'>\n\
<a class='delete'>\n\
<img src='http://icons.iconarchive.com/icons/icojam/blue-bits/16/symbol-delete-icon.png' />\n\
</a>\n\
<span class='devider'>-</span>\n\
<a class='mybutton'>\n\
<img src='http://icons.iconarchive.com/icons/custom-icon-design/flatastic-1/16/comment-icon.png' />\n\
</a>\n\
<span class='devider'>-</span>\n\
<a class='mybutton'>\n\
<img src='http://icons.iconarchive.com/icons/icojam/blue-bits/16/information-icon.png' />\n\
</a>\n\
</div>\n\
</div>";
$('.endo_'+ obj.Endorsment[i].lang).click(function () {
//$('#contenthover').toggle();
alert(obj.Endorsment[i].lang);
});
For more details, please refer to this LINK. Can anyone assist me with this?