This code below works fine when i put a number after my eq.
for (i=0; i<$("button.mark").length ; i++){
$("button.mark:eq(0)").on("click", e => {
e.preventDefault()
e.stopPropagation()
$("div.popup:eq(0)").show()
if ($("div.popup:eq(0)").css("display") === "block") {
$(window).on("click", () => {
$("div.popup:eq(0)").hide()
})
}
})
}
but it stop working when i try to put it in the for with i. Do you know why ?
for (i=0; i<$("button.mark").length ; i++){
$("button.mark:eq(i)").on("click", e => {
e.preventDefault()
e.stopPropagation()
$("div.popup:eq(i)").show()
if ($("div.popup:eq(i)").css("display") === "block") {
$(window).on("click", () => {
$("div.popup:eq(i)").hide()
})
}
})
}