I want to attach a number to an element brought from database.
$(document).on("click", ".addnum", function () {
........
$("#num-" + idd[1]).html(cki[1]);
});
in the above code, the selector, the $ part, is called from the database so basically it is not a fixed part in the body and the code works.
but in this part:
function checkcookie() {
var cookiee = document.cookie.split("; ");
for (let i = 0; i < cookiee.length; i++) {
var c = cookiee[i];
if (c.charAt(0) == "f" && c.charAt(1)== "o") {
var cki = c.split("="); //food-1 = 4
var idd = cki[0].split("-"); //food-1
$("#num-" + idd[1]).html(cki[1]);
}
}
}
the selector is again from database but it doesn't attach the value to it :(