Keeping chosen option on dropdown selected after page change

olivertickle

New Member
So I've built my first responsive site but having issues with the menu on the mobile device. It all works so that when your using the mobile you can select an option from the dropdown (HTML below) and it will take you off to the correct page. However when the page loads it defaults back to 'Home' Which is the first option in the list.This means you can't select home when you are on another page. But what I need is when the option is selected and the new page loads for the one selected to then become the default option. So you can go back to the homepage using the drop down.I've not done this before, so hoping it's fairly simple!HTML:\[code\]<form id="mobile_nav"> <select id="mobile_menu"> <option value="http://stackoverflow.com/">Home</option> <option value="http://stackoverflow.com/page 1/">page 1</option> <option value="http://stackoverflow.com/page 2/">page 2</option> <option value="http://stackoverflow.com/page 3/">page 3</option> <option value="http://stackoverflow.com/page 4/">page 4</option> <option value="http://stackoverflow.com/page 5/">page 5</option> </select></form>\[/code\]JS:\[code\]jQuery(document).ready(function() { nav(); jQuery("#mobile_menu").change(function() { document.location = jQuery(this).val(); });\[/code\]The JS enables the dropdown on the mobile device.Let me know if you need anymore info and thanks.
 
Back
Top