javascript - Jquery mobile - Click button to add to UL -
i trying build application when user enters text textbox on jquery based mobile app , clicks save adds list on screen
so default won't have list, user adds item list should created or if list exists, new item added new list item.
in terms of saving work on after, time being want dynamically append ul in jqm on screen
can assist code may this. giving me item added saying "item undefined" numslist list , txtbox textbox im not sure going wrong
thanks
<script> var $txtbox = $("#txtbox").val(); var count = 0; $("#main").live("pagecreate", function(event) { $("#numlist").listview({create: function(event, ui) { $("#addbtn").bind("click", function(event, ui) { var str = "<li><a href='#'>item " + ($txtbox) + "</a></li>"; $("#numlist").append(str); $("#numlist").listview("refresh"); }); $("#removebtn").bind("click", function(event, ui) { // if (--count < 0) { // count = 0; // return; // } $("#numlist").find("li").remove(); $("#numlist").listview("refresh"); }); }}); }); </script>
well, can use localstorage, way won't need code functions save/store data.
Comments
Post a Comment