I am trying to set some html in JQuery Mobile. It does add the html but it loses the CSS when the html is added to the div. The code is like this:
<div data-role="page" id="test">
<div>
<a id="testButton" data-role="button" data-inline="true">Hit me</a>
</div>
<div id="testDiv" data-role="content">
</div>
</div>
and Javascript to add some html in the "testDiv" like this:
$(document).ready(function()
{
$('#testButton').click(function() {
var output = '<ul data-role="listview">';
output += '<li><a href="#">Contact A</a></li>';
output += '<li><a href="#">Contact B</a></li>';
output += '<li><a href="#">Contact C</a></li>';
output += '</ul>';
$('#testDiv').html(output);
});
});
Any help will be appreciated.
Thanks