Replace listview item
Description
The following code shows how to replace listview item.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.css">
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){<!--from w ww. j a va2s. co m-->
$("#list li").each(function () {
var text = $(this).text();
$(this).replaceWith('<li><a href="http://java2s.com/">' + text + '</a></li>')
});
$('#list').listview('refresh');
});//]]>
</script>
</head>
<body>
<div id="list" data-role="listview" data-inset="true">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
</div>
</body>
</html>