JQuery Mobile bind event to listview
Posted
by
nycynik
on Stack Overflow
See other posts from Stack Overflow
or by nycynik
Published on 2012-09-30T01:13:06Z
Indexed on
2012/09/30
3:37 UTC
Read the original article
Hit count: 137
JavaScript
|jquery-mobile
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.
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.
© Stack Overflow or respective owner