Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <ul data-role="listview" data-split-icon="minus" id="list">
- <li>
- <a href="#">Item Description</a>
- <a href="#" class="delbtn">remove</a>
- </li>
- </ul>
- <a href="#" id="addbtn" class="ui-btn">Add item</a>
- var itemcount=1;
- $('#addbtn').click(function() {
- var addstr = '<li><a href="#">Item Description '+itemcount+'</a><a href="#" id="delbtn-'+itemcount+'" class="delbtn">remove</a></li></ul>';
- $('#list').append(addstr);
- $('#list').listview();
- $('#list').listview('refresh');
- itemcount++;
- });
- $('#list a.ui-li-link-alt').on("click",function() {
- alert('delbtn clicked');
- });
- $('#list').on("click", ".delbtn", function() {
- alert('delbtn clicked');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement