Last active
May 23, 2018 15:07
-
-
Save landbryo/6a2540c601fc5d515f37057ee28beaa9 to your computer and use it in GitHub Desktop.
Adds hashtag to URL based on selected option.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var url = window.location.href; | |
if (url.search("country=") >= 0) { | |
window.location.hash = "#locator"; | |
} | |
</script> | |
<a name="locator"></a> | |
<form> | |
<select name="country" id="country-menu"> | |
<option value="">FILTER BY COUNTRY</option> | |
<?php foreach($countries as $key => $label) : ?> | |
<option value="<?=$key?>" id="<?=$key?>"<?php if ($key== $country) : ?> selected<?php endif; ?>><?=$label?></option> | |
<?php endforeach?> | |
</select> | |
<input type="submit" style="display:none;"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment