html - How would i add more detail to my dynamic created list view with jquery mobile? -
how go adding href , listview header below code. if add in html part dont list html , js below
<script type="text/javascript"> $(document).on("pagebeforeshow", "#index1", function() { $(function(){ var items=""; $.getjson("check-events.php",function(data){ $.each(data,function(index,item) { items+="<li>"+item.enddate+"</li>"; }); $("#contacts").html(items); $("#contacts").listview("refresh"); }); }); }); </script> <div data-role="fieldcontain"> <ul id="contacts" data-role="listview" data-divider-theme="b" data-inset="true"> </ul> </div>
where put this
<li data-role="list-divider" role="heading"> list view </li>
let html code this:
<ul id="contacts" data-role="listview" data-divider-theme="b" data-inset="true"> <li data-role="list-divider" role="heading"> list view </li> </ul>
and instead of jquery line:
$("#contacts").html(items);
use one:
$("#contacts").append(items);
this way header in listview before start populating , append function add new content inside listview without removing previous one.
Comments
Post a Comment