I am attempting to programmatically change the text of a button in jQuery Mobile. When I do this the button loses some formatting. Below is code illustrating two attempts. Can any one suggest a way to do this that isn't going to jam up the browser?
<script>
$(document).bind("pageinit", function(){
$("#buttonId").text("New Text");
$("#buttonId").button("refresh");
});
//Method #2
$(document).ready(function () {
$("#buttonId").text("New Text");
$("#buttonId").button("refresh");
});
</script>
<a id="buttonId" href="" data-role="button">Old Text</a>