Vote count:
0
I would like to use .click functiom in for loop but it not working . its going to last loop for example if i put the consloe .log abaove the dot.click function its counting upto 9 but if i put it into .click function its showing value is 10; I would like to use the click() function of jQuery within a for loop in order to make three HTML elements clickable. I created a simple test case:
for (i = 1; i < 10; i++) {
console.log("value is"+i);
$("#next{i]").click(function () {
console.log("value is"+i);
$("#frm[i]).hide();
$("#frm[i+1]).show();
});
}
asked 2 mins ago
how to use a dot .click function in array
Aucun commentaire:
Enregistrer un commentaire