I am new to jQuery and JS. I have been wondering how to add a checkbox for each of the elements in the array aCurrencies, so I can be able to delete one or many of the elements in this array. My idea is to do this with the for loop I already have in the method below.
I made many unsuccessful attempts to code this, so any input will be highly appreciated.
function showHideCurrencies() {
$("#lblCurrencies").empty();
if (bShown == 0) {
$("#btnShowHideCurrencies").text("HIDE CURRENCIES");
bShown = 1;
for (var i = 0; i < aCurrencies.length; i++) {
$("#lblCurrencies").append("<div>" + aCurrencies[i] + "<i data-arrayIndex='" + i + "' class='fa fa-trash-o fa-fw'></i></div>")
}
$("#lblCurrencies").show();
} else {
$("#btnShowHideCurrencies").text("SHOW CURRENCIES");
bShown = 0;
$("#lblCurrencies").hide();
}
}
foreachloop ?lblCurrencies?