Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <ul data-role="listview" data-split-icon="minus" id="list">
  2. <li>
  3. <a href="#">Item Description</a>
  4. <a href="#" class="delbtn">remove</a>
  5. </li>
  6. </ul>
  7. <a href="#" id="addbtn" class="ui-btn">Add item</a>
  8.  
  9. var itemcount=1;
  10.  
  11. $('#addbtn').click(function() {
  12. var addstr = '<li><a href="#">Item Description '+itemcount+'</a><a href="#" id="delbtn-'+itemcount+'" class="delbtn">remove</a></li></ul>';
  13. $('#list').append(addstr);
  14. $('#list').listview();
  15. $('#list').listview('refresh');
  16. itemcount++;
  17. });
  18.  
  19. $('#list a.ui-li-link-alt').on("click",function() {
  20. alert('delbtn clicked');
  21. });
  22.  
  23. $('#list').on("click", ".delbtn", function() {
  24. alert('delbtn clicked');
  25. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement