I have a select box as follows. How do i mark an option as selected based on the last part of the url. ex: http://domain.com/index/one. The last part of the url is one so i want option one to be selected.
<select>
<option id="one">One</option>
<option id="two">Two</option>
<option id="three">Three</option>
</select>
I’m looking for jQuery or Javascript Solution.
also make sure you fix your select and give values to your options, not ids: