im new in mobile dev, im working on a simpl mobile app.
im using jquery mobile.
how can i get the value of the selected navbar?
my firt page is like this:
<div data-role="page" data-title="first" id="first" >
<div data-role="header" data-position="fixed" id="myheader">
<div data-role="navbar">
<ul>
<li><a href="#" class="ui-btn-active ui-state-persist">V</a></li>
<li><a href="#" class="ui-btn-active ui-state-persist">B</a></li>
<li><a href="#" class="ui-btn-active ui-state-persist">R</a></li>
<li><a href="#" class="ui-btn-active ui-state-persist">C</a></li>
</ul>
</div>
</div>
<div data-role="content" id="de">
<a href="#" data-role="button" onclick="simpldial()" >Afficher</a>
</div>
</div>
the function simpledial is this:
function simpledial() {
$('div #body').simpledialog2({
mode: 'blank',
headerText: '' ,
headerClose: false,
blankContent :
"<ul data-role='listview'>" +
"<li><a href='#second'>go second page</a></li>" +
"</ul>"+
"<a rel='close' data-role='button' href='#'>Close</a>"
});
}
the second page :
<div data-role="page" data-title="second" id="second" >
<div data-role="header" data-position="fixed" id="myheader">
</div>
<div data-role="content" id="dd">
<!-- Here i want to get the selected navbar in the first page -->
</div>
</div>
In the code you posted, all buttons are active because of the
ui-btn-activeclass you added.You should only use that class with the
ui-state-persistwith the nav you want active. Having that fixed, it would be as simple as:And you’ll get the text of the current navbar. If you want to select it in all pages of your application you should bind that getter to the
pageBeforeCreateevent: