Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add country list

  • Loading branch information...
commit c3897c823d4edb57f055db829dddd7f283a23150 1 parent 4734413
Jamie Appleseed authored October 25, 2011
263  index.html
@@ -10,10 +10,7 @@
10 10
 	  (function($){
11 11
 	    $(function(){
12 12
 	      $('select').selectToAutocomplete({
13  
-	        'sort': true,
14  
-	        handle_select_field: function( $select_field ) {
15  
-	          // do nothing
16  
-	        }
  13
+	        'sort': true
17 14
 	      });
18 15
 	      $('form').submit(function(){
19 16
 	        alert( $(this).serialize() );
@@ -41,6 +38,7 @@
41 38
       display: block;
42 39
       padding: 4px 6px;
43 40
       color: #353D44;
  41
+      cursor: pointer;
44 42
     }
45 43
     .ui-autocomplete .ui-menu-item:first-child a {
46 44
       border-top: none;
@@ -53,12 +51,259 @@
53 51
 </head>
54 52
 <body>
55 53
   <form>
56  
-    <select name="Country" id="hmm" test="tester" data-hello="test" class="hello-sir">
57  
-      <option value="">Select Country</option>
58  
-      <option value="United Kingdom id1" data-priority="2" data-alternative-spellings="uk britian england">United Kingdom</option>
59  
-      <option value="United States id2" selected="selected" data-priority="1" data-alternative-spellings="us usa america">United States</option>
60  
-      <option value="Zimbabwe id3" data-priority="3">Zimbabwe</option>
  54
+    <select name="Country" id="country-selector" autofocus="autofocus">
  55
+      <option value="" selected="selected">Select Country</option>
  56
+      <option value="Afghanistan" data-alternative-spellings="AF">Afghanistan</option>
  57
+      <option value="Åland Islands" data-alternative-spellings="AX Aaland Aland">Åland Islands</option>
  58
+      <option value="Albania" data-alternative-spellings="AL">Albania</option>
  59
+      <option value="Algeria" data-alternative-spellings="DZ">Algeria</option>
  60
+      <option value="American Samoa" data-alternative-spellings="AS">American Samoa</option>
  61
+      <option value="Andorra" data-alternative-spellings="AD">Andorra</option>
  62
+      <option value="Angola" data-alternative-spellings="AO">Angola</option>
  63
+      <option value="Anguilla" data-alternative-spellings="AI">Anguilla</option>
  64
+      <option value="Antarctica" data-alternative-spellings="AQ">Antarctica</option>
  65
+      <option value="Antigua And Barbuda" data-alternative-spellings="AG">Antigua And Barbuda</option>
  66
+      <option value="Argentina" data-alternative-spellings="AR">Argentina</option>
  67
+      <option value="Armenia" data-alternative-spellings="AM">Armenia</option>
  68
+      <option value="Aruba" data-alternative-spellings="AW">Aruba</option>
  69
+      <option value="Australia" data-alternative-spellings="AU">Australia</option>
  70
+      <option value="Austria" data-alternative-spellings="AT Österreich Osterreich Oesterreich ">Austria</option>
  71
+      <option value="Azerbaijan" data-alternative-spellings="AZ">Azerbaijan</option>
  72
+      <option value="Bahamas" data-alternative-spellings="BS">Bahamas</option>
  73
+      <option value="Bahrain" data-alternative-spellings="BH">Bahrain</option>
  74
+      <option value="Bangladesh" data-alternative-spellings="BD">Bangladesh</option>
  75
+      <option value="Barbados" data-alternative-spellings="BB">Barbados</option>
  76
+      <option value="Belarus" data-alternative-spellings="BY">Belarus</option>
  77
+      <option value="Belgium" data-alternative-spellings="BE">Belgium</option>
  78
+      <option value="Belize" data-alternative-spellings="BZ">Belize</option>
  79
+      <option value="Benin" data-alternative-spellings="BJ">Benin</option>
  80
+      <option value="Bermuda" data-alternative-spellings="BM">Bermuda</option>
  81
+      <option value="Bhutan" data-alternative-spellings="BT">Bhutan</option>
  82
+      <option value="Bolivia" data-alternative-spellings="BO">Bolivia</option>
  83
+      <option value="Bonaire, Sint Eustatius and Saba" data-alternative-spellings="BQ">Bonaire, Sint Eustatius and Saba</option>
  84
+      <option value="Bosnia and Herzegovina" data-alternative-spellings="BA">Bosnia and Herzegovina</option>
  85
+      <option value="Botswana" data-alternative-spellings="BW">Botswana</option>
  86
+      <option value="Bouvet Island" data-alternative-spellings="BV">Bouvet Island</option>
  87
+      <option value="Brazil" data-alternative-spellings="BR Brasil">Brazil</option>
  88
+      <option value="British Indian Ocean Territory" data-alternative-spellings="IO">British Indian Ocean Territory</option>
  89
+      <option value="Brunei Darussalam" data-alternative-spellings="BN">Brunei Darussalam</option>
  90
+      <option value="Bulgaria" data-alternative-spellings="BG">Bulgaria</option>
  91
+      <option value="Burkina Faso" data-alternative-spellings="BF">Burkina Faso</option>
  92
+      <option value="Burundi" data-alternative-spellings="BI">Burundi</option>
  93
+      <option value="Cambodia" data-alternative-spellings="KH">Cambodia</option>
  94
+      <option value="Cameroon" data-alternative-spellings="CM">Cameroon</option>
  95
+      <option value="Canada" data-alternative-spellings="CA">Canada</option>
  96
+      <option value="Cape Verde" data-alternative-spellings="CV">Cape Verde</option>
  97
+      <option value="Cayman Islands" data-alternative-spellings="KY">Cayman Islands</option>
  98
+      <option value="Central African Republic" data-alternative-spellings="CF">Central African Republic</option>
  99
+      <option value="Chad" data-alternative-spellings="TD">Chad</option>
  100
+      <option value="Chile" data-alternative-spellings="CL">Chile</option>
  101
+      <option value="China" data-alternative-spellings="CN Zhongguo Zhonghua">China</option>
  102
+      <option value="Christmas Island" data-alternative-spellings="CX">Christmas Island</option>
  103
+      <option value="Cocos (Keeling) Islands" data-alternative-spellings="CC">Cocos (Keeling) Islands</option>
  104
+      <option value="Colombia" data-alternative-spellings="CO">Colombia</option>
  105
+      <option value="Comoros" data-alternative-spellings="KM">Comoros</option>
  106
+      <option value="Congo" data-alternative-spellings="CG">Congo</option>
  107
+      <option value="Congo, the Democratic Republic of the" data-alternative-spellings="CD">Congo, the Democratic Republic of the</option>
  108
+      <option value="Cook Islands" data-alternative-spellings="CK">Cook Islands</option>
  109
+      <option value="Costa Rica" data-alternative-spellings="CR">Costa Rica</option>
  110
+      <option value="Côte d'Ivoire" data-alternative-spellings="CI Cote dIvoire">Côte d'Ivoire</option>
  111
+      <option value="Croatia" data-alternative-spellings="HR Hrvatska">Croatia</option>
  112
+      <option value="Cuba" data-alternative-spellings="CU">Cuba</option>
  113
+      <option value="Curaçao" data-alternative-spellings="CW Curacao">Curaçao</option>
  114
+      <option value="Cyprus" data-alternative-spellings="CY">Cyprus</option>
  115
+      <option value="Czech Republic" data-alternative-spellings="CZ Česká Ceska">Czech Republic</option>
  116
+      <option value="Denmark" data-alternative-spellings="DK Danmark">Denmark</option>
  117
+      <option value="Djibouti" data-alternative-spellings="DJ">Djibouti</option>
  118
+      <option value="Dominica" data-alternative-spellings="DM">Dominica</option>
  119
+      <option value="Dominican Republic" data-alternative-spellings="DO">Dominican Republic</option>
  120
+      <option value="Ecuador" data-alternative-spellings="EC">Ecuador</option>
  121
+      <option value="Egypt" data-alternative-spellings="EG">Egypt</option>
  122
+      <option value="El Salvador" data-alternative-spellings="SV">El Salvador</option>
  123
+      <option value="Equatorial Guinea" data-alternative-spellings="GQ">Equatorial Guinea</option>
  124
+      <option value="Eritrea" data-alternative-spellings="ER">Eritrea</option>
  125
+      <option value="Estonia" data-alternative-spellings="EE Eesti">Estonia</option>
  126
+      <option value="Ethiopia" data-alternative-spellings="ET">Ethiopia</option>
  127
+      <option value="Falkland Islands (Malvinas)" data-alternative-spellings="FK">Falkland Islands (Malvinas)</option>
  128
+      <option value="Faroe Islands" data-alternative-spellings="FO Føroyar Færøerne">Faroe Islands</option>
  129
+      <option value="Fiji" data-alternative-spellings="FJ">Fiji</option>
  130
+      <option value="Finland" data-alternative-spellings="FI Suomi">Finland</option>
  131
+      <option value="France" data-alternative-spellings="FR République française">France</option>
  132
+      <option value="French Guiana" data-alternative-spellings="GF">French Guiana</option>
  133
+      <option value="French Polynesia" data-alternative-spellings="PF">French Polynesia</option>
  134
+      <option value="French Southern Territories" data-alternative-spellings="TF">French Southern Territories</option>
  135
+      <option value="Gabon" data-alternative-spellings="GA">Gabon</option>
  136
+      <option value="Gambia" data-alternative-spellings="GM">Gambia</option>
  137
+      <option value="Georgia" data-alternative-spellings="GE">Georgia</option>
  138
+      <option value="Germany" data-alternative-spellings="DE Bundesrepublik Deutschland">Germany</option>
  139
+      <option value="Ghana" data-alternative-spellings="GH">Ghana</option>
  140
+      <option value="Gibraltar" data-alternative-spellings="GI">Gibraltar</option>
  141
+      <option value="Greece" data-alternative-spellings="GR">Greece</option>
  142
+      <option value="Greenland" data-alternative-spellings="GL grønland">Greenland</option>
  143
+      <option value="Grenada" data-alternative-spellings="GD">Grenada</option>
  144
+      <option value="Guadeloupe" data-alternative-spellings="GP">Guadeloupe</option>
  145
+      <option value="Guam" data-alternative-spellings="GU">Guam</option>
  146
+      <option value="Guatemala" data-alternative-spellings="GT">Guatemala</option>
  147
+      <option value="Guernsey" data-alternative-spellings="GG">Guernsey</option>
  148
+      <option value="Guinea" data-alternative-spellings="GN">Guinea</option>
  149
+      <option value="Guinea-Bissau" data-alternative-spellings="GW">Guinea-Bissau</option>
  150
+      <option value="Guyana" data-alternative-spellings="GY">Guyana</option>
  151
+      <option value="Haiti" data-alternative-spellings="HT">Haiti</option>
  152
+      <option value="Heard Island and McDonald Islands" data-alternative-spellings="HM">Heard Island and McDonald Islands</option>
  153
+      <option value="Holy See (Vatican City State)" data-alternative-spellings="VA">Holy See (Vatican City State)</option>
  154
+      <option value="Honduras" data-alternative-spellings="HN">Honduras</option>
  155
+      <option value="Hong Kong" data-alternative-spellings="HK">Hong Kong</option>
  156
+      <option value="Hungary" data-alternative-spellings="HU">Hungary</option>
  157
+      <option value="Iceland" data-alternative-spellings="IS Island">Iceland</option>
  158
+      <option value="India" data-alternative-spellings="IN">India</option>
  159
+      <option value="Indonesia" data-alternative-spellings="ID">Indonesia</option>
  160
+      <option value="Iran, Islamic Republic of" data-alternative-spellings="IR">Iran, Islamic Republic of</option>
  161
+      <option value="Iraq" data-alternative-spellings="IQ">Iraq</option>
  162
+      <option value="Ireland" data-alternative-spellings="IE Éire">Ireland</option>
  163
+      <option value="Isle of Man" data-alternative-spellings="IM">Isle of Man</option>
  164
+      <option value="Israel" data-alternative-spellings="IL">Israel</option>
  165
+      <option value="Italy" data-alternative-spellings="IT Italia">Italy</option>
  166
+      <option value="Jamaica" data-alternative-spellings="JM">Jamaica</option>
  167
+      <option value="Japan" data-alternative-spellings="JP">Japan</option>
  168
+      <option value="Jersey" data-alternative-spellings="JE">Jersey</option>
  169
+      <option value="Jordan" data-alternative-spellings="JO">Jordan</option>
  170
+      <option value="Kazakhstan" data-alternative-spellings="KZ">Kazakhstan</option>
  171
+      <option value="Kenya" data-alternative-spellings="KE">Kenya</option>
  172
+      <option value="Kiribati" data-alternative-spellings="KI">Kiribati</option>
  173
+      <option value="Korea, Democratic People's Republic of" data-alternative-spellings="KP North Korea">Korea, Democratic People's Republic of</option>
  174
+      <option value="Korea, Republic of" data-alternative-spellings="KR South Korea">Korea, Republic of</option>
  175
+      <option value="Kuwait" data-alternative-spellings="KW">Kuwait</option>
  176
+      <option value="Kyrgyzstan" data-alternative-spellings="KG">Kyrgyzstan</option>
  177
+      <option value="Lao People's Democratic Republic" data-alternative-spellings="LA">Lao People's Democratic Republic</option>
  178
+      <option value="Latvia" data-alternative-spellings="LV">Latvia</option>
  179
+      <option value="Lebanon" data-alternative-spellings="LB">Lebanon</option>
  180
+      <option value="Lesotho" data-alternative-spellings="LS">Lesotho</option>
  181
+      <option value="Liberia" data-alternative-spellings="LR">Liberia</option>
  182
+      <option value="Libyan Arab Jamahiriya" data-alternative-spellings="LY">Libyan Arab Jamahiriya</option>
  183
+      <option value="Liechtenstein" data-alternative-spellings="LI">Liechtenstein</option>
  184
+      <option value="Lithuania" data-alternative-spellings="LT">Lithuania</option>
  185
+      <option value="Luxembourg" data-alternative-spellings="LU">Luxembourg</option>
  186
+      <option value="Macao" data-alternative-spellings="MO">Macao</option>
  187
+      <option value="Macedonia, The Former Yugoslav Republic Of" data-alternative-spellings="MK">Macedonia, The Former Yugoslav Republic Of</option>
  188
+      <option value="Madagascar" data-alternative-spellings="MG">Madagascar</option>
  189
+      <option value="Malawi" data-alternative-spellings="MW">Malawi</option>
  190
+      <option value="Malaysia" data-alternative-spellings="MY">Malaysia</option>
  191
+      <option value="Maldives" data-alternative-spellings="MV">Maldives</option>
  192
+      <option value="Mali" data-alternative-spellings="ML">Mali</option>
  193
+      <option value="Malta" data-alternative-spellings="MT">Malta</option>
  194
+      <option value="Marshall Islands" data-alternative-spellings="MH">Marshall Islands</option>
  195
+      <option value="Martinique" data-alternative-spellings="MQ">Martinique</option>
  196
+      <option value="Mauritania" data-alternative-spellings="MR">Mauritania</option>
  197
+      <option value="Mauritius" data-alternative-spellings="MU">Mauritius</option>
  198
+      <option value="Mayotte" data-alternative-spellings="YT">Mayotte</option>
  199
+      <option value="Mexico" data-alternative-spellings="MX Mexicanos">Mexico</option>
  200
+      <option value="Micronesia, Federated States of" data-alternative-spellings="FM">Micronesia, Federated States of</option>
  201
+      <option value="Moldova, Republic of" data-alternative-spellings="MD">Moldova, Republic of</option>
  202
+      <option value="Monaco" data-alternative-spellings="MC">Monaco</option>
  203
+      <option value="Mongolia" data-alternative-spellings="MN">Mongolia</option>
  204
+      <option value="Montenegro" data-alternative-spellings="ME">Montenegro</option>
  205
+      <option value="Montserrat" data-alternative-spellings="MS">Montserrat</option>
  206
+      <option value="Morocco" data-alternative-spellings="MA">Morocco</option>
  207
+      <option value="Mozambique" data-alternative-spellings="MZ">Mozambique</option>
  208
+      <option value="Myanmar" data-alternative-spellings="MM">Myanmar</option>
  209
+      <option value="Namibia" data-alternative-spellings="NA">Namibia</option>
  210
+      <option value="Nauru" data-alternative-spellings="NR">Nauru</option>
  211
+      <option value="Nepal" data-alternative-spellings="NP">Nepal</option>
  212
+      <option value="Netherlands" data-alternative-spellings="NL Holland Nederland">Netherlands</option>
  213
+      <option value="New Caledonia" data-alternative-spellings="NC">New Caledonia</option>
  214
+      <option value="New Zealand" data-alternative-spellings="NZ">New Zealand</option>
  215
+      <option value="Nicaragua" data-alternative-spellings="NI">Nicaragua</option>
  216
+      <option value="Niger" data-alternative-spellings="NE">Niger</option>
  217
+      <option value="Nigeria" data-alternative-spellings="NG">Nigeria</option>
  218
+      <option value="Niue" data-alternative-spellings="NU">Niue</option>
  219
+      <option value="Norfolk Island" data-alternative-spellings="NF">Norfolk Island</option>
  220
+      <option value="Northern Mariana Islands" data-alternative-spellings="MP">Northern Mariana Islands</option>
  221
+      <option value="Norway" data-alternative-spellings="NO Norge Noreg">Norway</option>
  222
+      <option value="Oman" data-alternative-spellings="OM">Oman</option>
  223
+      <option value="Pakistan" data-alternative-spellings="PK">Pakistan</option>
  224
+      <option value="Palau" data-alternative-spellings="PW">Palau</option>
  225
+      <option value="Palestinian Territory, Occupied" data-alternative-spellings="PS">Palestinian Territory, Occupied</option>
  226
+      <option value="Panama" data-alternative-spellings="PA">Panama</option>
  227
+      <option value="Papua New Guinea" data-alternative-spellings="PG">Papua New Guinea</option>
  228
+      <option value="Paraguay" data-alternative-spellings="PY">Paraguay</option>
  229
+      <option value="Peru" data-alternative-spellings="PE">Peru</option>
  230
+      <option value="Philippines" data-alternative-spellings="PH">Philippines</option>
  231
+      <option value="Pitcairn" data-alternative-spellings="PN">Pitcairn</option>
  232
+      <option value="Poland" data-alternative-spellings="PL">Poland</option>
  233
+      <option value="Portugal" data-alternative-spellings="PT">Portugal</option>
  234
+      <option value="Puerto Rico" data-alternative-spellings="PR">Puerto Rico</option>
  235
+      <option value="Qatar" data-alternative-spellings="QA">Qatar</option>
  236
+      <option value="Réunion" data-alternative-spellings="RE Reunion">Réunion</option>
  237
+      <option value="Romania" data-alternative-spellings="RO">Romania</option>
  238
+      <option value="Russian Federation" data-alternative-spellings="RU Russia Rossiya">Russian Federation</option>
  239
+      <option value="Rwanda" data-alternative-spellings="RW">Rwanda</option>
  240
+      <option value="Saint Barthélemy" data-alternative-spellings="BL">Saint Barthélemy</option>
  241
+      <option value="Saint Helena" data-alternative-spellings="SH">Saint Helena</option>
  242
+      <option value="Saint Kitts and Nevis" data-alternative-spellings="KN">Saint Kitts and Nevis</option>
  243
+      <option value="Saint Lucia" data-alternative-spellings="LC">Saint Lucia</option>
  244
+      <option value="Saint Martin (French Part)" data-alternative-spellings="MF">Saint Martin (French Part)</option>
  245
+      <option value="Saint Pierre and Miquelon" data-alternative-spellings="PM">Saint Pierre and Miquelon</option>
  246
+      <option value="Saint Vincent and the Grenadines" data-alternative-spellings="VC">Saint Vincent and the Grenadines</option>
  247
+      <option value="Samoa" data-alternative-spellings="WS">Samoa</option>
  248
+      <option value="San Marino" data-alternative-spellings="SM">San Marino</option>
  249
+      <option value="Sao Tome and Principe" data-alternative-spellings="ST">Sao Tome and Principe</option>
  250
+      <option value="Saudi Arabia" data-alternative-spellings="SA">Saudi Arabia</option>
  251
+      <option value="Senegal" data-alternative-spellings="SN">Senegal</option>
  252
+      <option value="Serbia" data-alternative-spellings="RS">Serbia</option>
  253
+      <option value="Seychelles" data-alternative-spellings="SC">Seychelles</option>
  254
+      <option value="Sierra Leone" data-alternative-spellings="SL">Sierra Leone</option>
  255
+      <option value="Singapore" data-alternative-spellings="SG">Singapore</option>
  256
+      <option value="Sint Maarten (Dutch Part)" data-alternative-spellings="SX">Sint Maarten (Dutch Part)</option>
  257
+      <option value="Slovakia" data-alternative-spellings="SK">Slovakia</option>
  258
+      <option value="Slovenia" data-alternative-spellings="SI">Slovenia</option>
  259
+      <option value="Solomon Islands" data-alternative-spellings="SB">Solomon Islands</option>
  260
+      <option value="Somalia" data-alternative-spellings="SO">Somalia</option>
  261
+      <option value="South Africa" data-alternative-spellings="ZA">South Africa</option>
  262
+      <option value="South Georgia and the South Sandwich Islands" data-alternative-spellings="GS">South Georgia and the South Sandwich Islands</option>
  263
+      <option value="South Sudan" data-alternative-spellings="SS">South Sudan</option>
  264
+      <option value="Spain" data-alternative-spellings="ES España">Spain</option>
  265
+      <option value="Sri Lanka" data-alternative-spellings="LK">Sri Lanka</option>
  266
+      <option value="Sudan" data-alternative-spellings="SD">Sudan</option>
  267
+      <option value="Suriname" data-alternative-spellings="SR">Suriname</option>
  268
+      <option value="Svalbard and Jan Mayen" data-alternative-spellings="SJ">Svalbard and Jan Mayen</option>
  269
+      <option value="Swaziland" data-alternative-spellings="SZ">Swaziland</option>
  270
+      <option value="Sweden" data-alternative-spellings="SE Sverige">Sweden</option>
  271
+      <option value="Switzerland" data-alternative-spellings="CH Swiss Confederation Schweiz Suisse Svizzera Svizra">Switzerland</option>
  272
+      <option value="Syrian Arab Republic" data-alternative-spellings="SY Syria">Syrian Arab Republic</option>
  273
+      <option value="Taiwan, Province of China" data-alternative-spellings="TW">Taiwan, Province of China</option>
  274
+      <option value="Tajikistan" data-alternative-spellings="TJ">Tajikistan</option>
  275
+      <option value="Tanzania, United Republic of" data-alternative-spellings="TZ">Tanzania, United Republic of</option>
  276
+      <option value="Thailand" data-alternative-spellings="TH">Thailand</option>
  277
+      <option value="Timor-Leste" data-alternative-spellings="TL">Timor-Leste</option>
  278
+      <option value="Togo" data-alternative-spellings="TG">Togo</option>
  279
+      <option value="Tokelau" data-alternative-spellings="TK">Tokelau</option>
  280
+      <option value="Tonga" data-alternative-spellings="TO">Tonga</option>
  281
+      <option value="Trinidad and Tobago" data-alternative-spellings="TT">Trinidad and Tobago</option>
  282
+      <option value="Tunisia" data-alternative-spellings="TN">Tunisia</option>
  283
+      <option value="Turkey" data-alternative-spellings="TR Türkiye Turkiye">Turkey</option>
  284
+      <option value="Turkmenistan" data-alternative-spellings="TM">Turkmenistan</option>
  285
+      <option value="Turks and Caicos Islands" data-alternative-spellings="TC">Turks and Caicos Islands</option>
  286
+      <option value="Tuvalu" data-alternative-spellings="TV">Tuvalu</option>
  287
+      <option value="Uganda" data-alternative-spellings="UG">Uganda</option>
  288
+      <option value="Ukraine" data-alternative-spellings="UA Ukrayina">Ukraine</option>
  289
+      <option value="United Arab Emirates" data-alternative-spellings="AE UAE Emirates">United Arab Emirates</option>
  290
+      <option value="United Kingdom" data-priority="2" data-alternative-spellings="GB Great Britain">United Kingdom</option>
  291
+      <option value="United States" data-priority="1" data-alternative-spellings="US USA United States of America">United States</option>
  292
+      <option value="United States Minor Outlying Islands" data-alternative-spellings="UM">United States Minor Outlying Islands</option>
  293
+      <option value="Uruguay" data-alternative-spellings="UY">Uruguay</option>
  294
+      <option value="Uzbekistan" data-alternative-spellings="UZ">Uzbekistan</option>
  295
+      <option value="Vanuatu" data-alternative-spellings="VU">Vanuatu</option>
  296
+      <option value="Venezuela" data-alternative-spellings="VE">Venezuela</option>
  297
+      <option value="Vietnam" data-alternative-spellings="VN">Vietnam</option>
  298
+      <option value="Virgin Islands, British" data-alternative-spellings="VG">Virgin Islands, British</option>
  299
+      <option value="Virgin Islands, U.S." data-alternative-spellings="VI">Virgin Islands, U.S.</option>
  300
+      <option value="Wallis and Futuna" data-alternative-spellings="WF">Wallis and Futuna</option>
  301
+      <option value="Western Sahara" data-alternative-spellings="EH">Western Sahara</option>
  302
+      <option value="Yemen" data-alternative-spellings="YE">Yemen</option>
  303
+      <option value="Zambia" data-alternative-spellings="ZM">Zambia</option>
  304
+      <option value="Zimbabwe" data-alternative-spellings="ZW">Zimbabwe</option>
61 305
     </select>
  306
+    
62 307
     <input type="submit" value="Submit">
63 308
   </form>
64 309
 </body>
23  jquery.select-to-autocomplete.js
... ...
@@ -1,5 +1,5 @@
1 1
 /*
2  
-Copyright (C) 2011 by Jamie Appleseed at Baymard Institute
  2
+Copyright (C) 2011 by Jamie Appleseed, Baymard Institute (baymard.com)
3 3
 
4 4
 Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
 of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,9 @@ THE SOFTWARE.
29 29
     'remove-valueless-options': true,
30 30
     'copy-attributes-to-text-field': true,
31 31
     'autocomplete-plugin': 'jquery_ui',
32  
-    'clear-invalid-input': true,
  32
+    handle_invalid_input: function( context ) {
  33
+      context.$text_field.val( '' );
  34
+    },
33 35
     handle_select_field: function( $select_field ) {
34 36
       return $select_field.hide();
35 37
     },
@@ -153,17 +155,20 @@ THE SOFTWARE.
153 155
         if ( option ) {
154 156
           context.$select_field.val( option['real-value'] );
155 157
         } else {
156  
-          var option_name = context.$text_field.val();
157  
-          var option_value = '';
  158
+          var option_name = context.$text_field.val().toLowerCase();
  159
+          var matching_option = { 'real-value': false };
158 160
           for (var i=0; i < context.options.length; i++) {
159  
-            if ( option_name === context.options[i]['label'] ) {
160  
-              option_value = context.options[i]['real-value'];
  161
+            if ( option_name === context.options[i]['label'].toLowerCase() ) {
  162
+              matching_option = context.options[i];
161 163
               break;
162 164
             }
163 165
           };
164  
-          context.$select_field.val( option_value );
165  
-  		    if ( context.settings['clear-invalid-input'] && context.$select_field.val() === '' ) {
166  
-  		      context.$text_field.val( '' );
  166
+          context.$select_field.val( matching_option['real-value'] || '' );
  167
+          if ( matching_option['real-value'] ) {
  168
+            context.$text_field.val( matching_option['label'] );
  169
+          }
  170
+  		    if ( typeof context.settings['handle_invalid_input'] === 'function' && context.$select_field.val() === '' ) {
  171
+  		      context.settings['handle_invalid_input']( context );
167 172
   		    }
168 173
         }
169 174
       }

0 notes on commit c3897c8

Please sign in to comment.
Something went wrong with that request. Please try again.