Last active
May 5, 2016 22:45
-
-
Save salsalabs/8118c4fe62d756f5505f0704f779c6d7 to your computer and use it in GitHub Desktop.
Show Hong Kong districts when the Country field changes to "Hong Kong".
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 type="text/javascript"> | |
// SalsaStaff 126206: Change the State options to be the Hong Kong districts as needed. | |
// @see https://salsasupport.zendesk.com/entries/99164537 | |
// @see https://en.wikipedia.org/wiki/Districts_of_Hong_Kong | |
$(document).ready(function() { | |
var country = $('*[name=Country]'); | |
if (country.length != 0) { | |
country.change(function() { | |
if (country.val() == 'HK') { | |
$('*[name=State]') | |
.empty() | |
.append($('#hong-kong-districts').children()); | |
} | |
}); | |
} | |
}) | |
</script> | |
<select style="display: none;" id="hong-kong-districts"> | |
<option value="">Please choose a district</option> | |
<option value="Central and Western">Central and Western</option> | |
<option value="Eastern">Eastern</option> | |
<option value="Islands">Islands</option> | |
<option value="Kowloon City">Kowloon City</option> | |
<option value="Kwai Tsing">Kwai Tsing</option> | |
<option value="Kwun Tong">Kwun Tong</option> | |
<option value="North">North</option> | |
<option value="Sai Kung">Sai Kung</option> | |
<option value="Sha Tin ">Sha Tin </option> | |
<option value="Sham Shui Po">Sham Shui Po</option> | |
<option value="Southern">Southern</option> | |
<option value="Tai Po">Tai Po</option> | |
<option value="Tsuen Wan">Tsuen Wan</option> | |
<option value="Tuen Mun">Tuen Mun</option> | |
<option value="Wan Chai">Wan Chai</option> | |
<option value="Wong Tai Sin">Wong Tai Sin</option> | |
<option value="Yau Tsim Mong">Yau Tsim Mong</option> | |
<option value="Yuen Long">Yuen Long</option> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment