Dynamically add listview and item
Description
The following code shows how to dynamically add listview and item.
Example
<!-- w w w . j a v a2 s.c o m-->
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-2.0.0.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.css">
<script type='text/javascript'>
$(window).load(function(){
$("#ListDiv").append('<ul id="List" data-role="listview"></ul>');
$('#List').append('<li>Item1</li>');
$('#List').listview();
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="content" id="ListDiv"></div>
<!-- /content -->
</div>
<!-- /page -->
</body>
</html>