jQuery Mobile and Select menu with URLs

Posted by user1907347 on Stack Overflow See other posts from Stack Overflow or by user1907347
Published on 2012-12-16T05:00:55Z Indexed on 2012/12/16 5:03 UTC
Read the original article Hit count: 132

Filed under:
|
|
|
|

Been battling with this for a while now. I'm trying to get a select menu to work as a navigation menu but I cannot get the URLs to work and have it actually change pages.

In the head:

<script>
$(function() {
    $("#select-choice-1").click(function() {
        $.mobile.changePage($("#select-choice-1"));
    });        
});
</script>

With this Menu:

<div id="MobileWrapper" data-role="fieldcontain">
<select name="select-choice-1" id="select-choice-1" data-theme="a" data-form="ui-btn-up-a" data-mini="true">
<option data-placeholder="true">Navigation</option><!-- data=placeholder makes this not show up in the pop up-->
<option value="/index.php" data-ajax="false">Home</option>
<option value="/services/index.php" data-ajax="false">Services</option>
<option value="/trainers/index.php" data-ajax="false">Trainers</option>
<option value="/locations/index.php" data-ajax="false">Locations</option>
<option value="/calendar/index.php" data-ajax="false">Calendar</option>
<option value="/contactus/index.php" data-ajax="false">Contact Us</option>
</select>
</div><!--END MobileWrapper DIV-->

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about url