http://jsfiddle.net/SuSpv/
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
<script>
var listCreated = false;
function appendToList(){
//Create the listview if not created
if(!listCreated){
$("#content").append("<ul id='list' data-role='listview' data-inset='true'></ul>");
listCreated = true;
$("#content").trigger("create");
}
$("#list").append("<li>Item</li>");
$("#list").listview("refresh");
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="content" id="content">
<input type="button" value="Add item to list" onclick="appendToList()"/>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>
JQuery Mobile - Dynamically build listview (ul li)
Related Posts:
jQuery - get json data from file or service Json File { "german": { "howto": [ { &n… Read More
JQuery Mobile - Dynamically build listview (ul li)http://jsfiddle.net/SuSpv/ <!DOCTYPE html><html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> &nbs… Read More
Create GUID in JavaScript Case 1: jquery.guid.js var guid = jQuery.Guid.New() but sometimes, it return an error Guid is undefined, etc ... Case 2: function S4() { return (((1+Math.random())*0x10000)|0).toStr… Read More
Jquery - UI Design Toolshttps://01.org/rib/downloads http://www.mobjectify.com/ http://tiggzi.com/home http://appery.io http://driftyco.github.io/graphite/ https://codiqa.com/ http://driftyco.github.io/graphite/ … Read More
0 comments:
Post a Comment