Appending a list, binding to event is not working.
Hi I have the following code that when selected adds another item to the list. The problem I have is that the additional item does not get recognised on the following event handler especially as I want to return the id and the data-stream value. It works perfectly fine on the first block of code but not when the second is added.
- <ul data-role="listview" data-inset="true" data-theme="e" id="heatsMenu" style="border:2px solid #fff;">
- <li id="a" data-stream="1"><a href="#display_details" data-transition="slide"> 4</a></li>
- <li id="b" data-stream="2"><a href="#display_details" data-transition="slide">11</a></li>
- <li id="c" data-stream="3"><a href="#display_details" data-transition="slide">Nominated</a></li>
- </ul>
This is bound to the following event:
- $('#heatsMenu>li').bind('click', function(e){
- $('#heatsMenu').append('<li id="d" data-stream="2"><a href="#">Thanks</a></li>');
- $('#heatsMenu').listview('refresh');
- });
But this is not get recognised when clicked/tapped and the values are not returned.
Thanks in advance,
Lammie.