I try to get the id of li in listview by using following code
$("#detailr").append(" <li class=\"item box_btn\" id=\""+ item.appid +"\"><div class=\"list\" ><div class=\"list-left\"><img src=\"uploadb/"+ item.appicon +"\"><ul><li><b>"+ item.appname +"</b><span>Left"+ item.leftc +"</span></li><li><img src=\"img/32.png\">Done"+ item.appdone +"</li><li class=\"spe\">search\""+ item.appname +"\"</li></ul></div><div class=\"list-right\"><div class=\"yuan\">+"+ item.appprice +"</div></div></div></li>");});
and click events
<script type="text/javascript">
$(document).ready(function(){
$('#detailr').children('li').click(function () { //
alert($(this).attr('id'));
});
});
</script>
the html content
<ul data-role="listview" id="detailr">
</ul>
when I click the li, there no response, and I change $('#detailr').children('li').click(function ()
to $('#detailr li').click(function ()
, $('#detailr').children('li').on("click", function ()
, also doesn't work, I don't understand why, please help me, many thanks.