I'm having trouble updating an element, via jQuery. I'll summarize the codes:
HTML
<div data-role="header" data-position="fixed" data-tap-toggle="false">
<a href="#nav-panel" data-icon="bars" data-iconpos="notext">Menu</a>
<h1>Ranking</h1>
<a id="btnPlayerName" href="#" class="ui-btn-right">Player</a>
</div>
<div data-role="content">
<ul id="rankingList" data-role="listview"></ul>
</div>
JS
$(document).on('pageshow', '#pagRanking', function() {
headerData();
})
function headerData() {
if(sessionStorage.getItem('mbPlayerID') == null) {
window.location.href="index.php";
}
$("#btnPlayerName").empty();
lblPN = '<span class="ui-btn-inner">';
lblPN += '<span class="ui-btn-class">';
lblPN += playerName;
lblPN += '</span>';
lblPN += '</span>';
$("#btnPlayerName").append(lblPN);
}
Everything is OK with the session, but append
does not work.
Any ideas?