Reputation: 303
I'm using a select box as a menu nav for my jQuery Mobile site.
Some items of the menu link to internal pages and others to external URLs.
I'm using the following to code to change page url:
$('#menu-select').change(function() {
window.location = $(this).data('location')
})
The HTML:
<select name='select-choice-1' id="menu-select">
<option value="">Menú:</option>
<option value="index.php">Noticias</option>
<option value="index.php#tramites" data-location='index.php#tramites'>Trámites</option>
<option value="index.php#twitter" data-location='index.php#twitter'>Twitter</option>
<option value="virgen_del_valle.php">Parque Virgen del Valle</option>
</select>
I have three pages:
The problem is that when I select, for example, Home option, then More Information and tried to go to Event, it didn't load the page.
It's inconsistent with external and internal url loading.
I think this code must have a conditional for internal pages and for external url.
Hope you can help.
Thanks.
Upvotes: 1
Views: 2083
Reputation: 8852
$('#menu-select').change(function () {
window.location = $(this).val();
});
Upvotes: 2