How to save my selected option in the selection box, when i reload the page with javascript location.href ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The page itself has no state and won’t remember anything the user did when you reload it.
If you are using a server-side language as well you can save the value somewhere on the server (a database or simple flat file), but if you just have javascript and can’t save the value to the server you can take a look at saving the value to a cookie and then restoring that value when the page reloads.
If you’re feeling really adventurous, HTML5 also gives you the ability to save content to something called local storage, although this is only supported by more advanced browsers.