I've got a looped click function in my application something similar to
for(var i = 0; i < 10; i++)
{
$("#clickedButton"+i+"").click(function()
{
//Code Here
}
}
My issue is that I need a way to tell which button is clicked. I could just create 9 click functions but they all do the exact same thing so I figured looping it would be best. Is there a way I can tell which one is clicked. I have been able to successfully do this once like shown below
var i = 0;
if(i == 0)
{
alert(i);
$("#amount0").empty();
amountCount[0]--;
$("#amount0").append(amountCount[0]);
}
i++
When I try to add on a second if statement when it loops through on the click it changes the information in the first if statement as well. I need to be able to individually change the information and the buttons can be clicked multiple times in any order.
If any other information is needed let me know
Aucun commentaire:
Enregistrer un commentaire