JQuery Mobile bind event to listview
- by nycynik
I am trying to add a vclick to a dynamic JQM listview. But I can not figure out how to identify which number is being clicked.
http://jsfiddle.net/2hR9w/
for (var x=0; x<2; x++ ) {
$("#listitem"+x).bind("vclick",function(e)
{ console.log("clicked"+x); });
console.log(x);
}
?
Something is wrong with the code, but i can't figure out why x is always the max loop value, since I feel like it should be set at the time of the loop.
it always reads clicked2, never clicked1.