I have a <select> containing different page titles, a click on a title automatically redirects towards the selected page. But once the user gets there, I want the title of the page to be the selected option in the <select>.
So If one goes to the “books” page, once there, I want to see “books” in the <select>.
Is there a quick and easy way to achieve this ?
If you want to do this client side, and the values of all of your select options are absolute URLs to the “linked” page, then write something like this:
If the location isn’t in the list then the previously selected (either the first option or whichever one has the
selectedattribute) will be selected.If you want to do this server side, then as you write out all of your select options, add the
selectedattribute if the current option is for the page that you are writing out.