Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                  <h1>Lightweight HTML5 auto-complete</h1>

  <form id="autoform">

    <label for="country1">country 1 (datalist uses <code>&lt;option&gt;value&lt;/option&gt;</code>):</label>
    <input list="countrydata1" id="country1" name="country1" size="50" autocomplete="off" />
    
    <label for="country2">country 2 (datalist uses <code>&lt;option value="value" /&gt;</code>):</label>
    <input list="countrydata2" id="country2" name="country2" size="50" autocomplete="off" />
    
    <label for="country3">country 3 (datalist uses <code>&lt;option value="value"&gt;name&lt;/option&gt;</code>):</label>
    <input list="countrydata3" id="country3" name="country3" size="50" autocomplete="off" />
    
    <label for="country4">country 4 (datalist uses <code>&lt;option value="value" label="name" /&gt;</code>):</label>
    <input list="countrydata3" id="country3" name="country3" size="50" autocomplete="off" />

    <button type="submit">submit</button>

  </form>

<datalist id="countrydata1">
  <option>Afghanistan</option>
  <option>Åland Islands</option>
  <option>Albania</option>
  <option>Algeria</option>
  <option>American Samoa</option>
  <option>Andorra</option>
  <option>Angola</option>
  <option>Anguilla</option>
  <option>Antarctica</option>
  <option>Antigua and Barbuda</option>
  <option>Argentina</option>
  <option>Armenia</option>
  <option>Aruba</option>
  <option>Australia</option>
  <option>Austria</option>
  <option>Azerbaijan</option>
  <option>Bahamas</option>
  <option>Bahrain</option>
  <option>Bangladesh</option>
  <option>Barbados</option>
  <option>Belarus</option>
  <option>Belgium</option>
  <option>Belize</option>
  <option>Benin</option>
  <option>Bermuda</option>
  <option>Bhutan</option>
  <option>Bolivia (Plurinational State of)</option>
  <option>Bonaire, Sint Eustatius and Saba</option>
  <option>Bosnia and Herzegovina</option>
  <option>Botswana</option>
  <option>Bouvet Island</option>
  <option>Brazil</option>
  <option>British Indian Ocean Territory</option>
  <option>Brunei Darussalam</option>
  <option>Bulgaria</option>
  <option>Burkina Faso</option>
  <option>Burundi</option>
  <option>Cabo Verde</option>
  <option>Cambodia</option>
  <option>Cameroon</option>
  <option>Canada</option>
  <option>Cayman Islands</option>
  <option>Central African Republic</option>
  <option>Chad</option>
  <option>Chile</option>
  <option>China</option>
  <option>Christmas Island</option>
  <option>Cocos (Keeling) Islands</option>
  <option>Colombia</option>
  <option>Comoros</option>
  <option>Congo</option>
  <option>Congo, Democratic Republic of the</option>
  <option>Cook Islands</option>
  <option>Costa Rica</option>
  <option>Côte d'Ivoire</option>
  <option>Croatia</option>
  <option>Cuba</option>
  <option>Curaçao</option>
  <option>Cyprus</option>
  <option>Czechia</option>
  <option>Denmark</option>
  <option>Djibouti</option>
  <option>Dominica</option>
  <option>Dominican Republic</option>
  <option>Ecuador</option>
  <option>Egypt</option>
  <option>El Salvador</option>
  <option>Equatorial Guinea</option>
  <option>Eritrea</option>
  <option>Estonia</option>
  <option>Eswatini</option>
  <option>Ethiopia</option>
  <option>Falkland Islands (Malvinas)</option>
  <option>Faroe Islands</option>
  <option>Fiji</option>
  <option>Finland</option>
  <option>France</option>
  <option>French Guiana</option>
  <option>French Polynesia</option>
  <option>French Southern Territories</option>
  <option>Gabon</option>
  <option>Gambia</option>
  <option>Georgia</option>
  <option>Germany</option>
  <option>Ghana</option>
  <option>Gibraltar</option>
  <option>Greece</option>
  <option>Greenland</option>
  <option>Grenada</option>
  <option>Guadeloupe</option>
  <option>Guam</option>
  <option>Guatemala</option>
  <option>Guernsey</option>
  <option>Guinea</option>
  <option>Guinea-Bissau</option>
  <option>Guyana</option>
  <option>Haiti</option>
  <option>Heard Island and McDonald Islands</option>
  <option>Holy See</option>
  <option>Honduras</option>
  <option>Hong Kong</option>
  <option>Hungary</option>
  <option>Iceland</option>
  <option>India</option>
  <option>Indonesia</option>
  <option>Iran (Islamic Republic of)</option>
  <option>Iraq</option>
  <option>Ireland</option>
  <option>Isle of Man</option>
  <option>Israel</option>
  <option>Italy</option>
  <option>Jamaica</option>
  <option>Japan</option>
  <option>Jersey</option>
  <option>Jordan</option>
  <option>Kazakhstan</option>
  <option>Kenya</option>
  <option>Kiribati</option>
  <option>Korea (Democratic People's Republic of)</option>
  <option>Korea, Republic of</option>
  <option>Kuwait</option>
  <option>Kyrgyzstan</option>
  <option>Lao People's Democratic Republic</option>
  <option>Latvia</option>
  <option>Lebanon</option>
  <option>Lesotho</option>
  <option>Liberia</option>
  <option>Libya</option>
  <option>Liechtenstein</option>
  <option>Lithuania</option>
  <option>Luxembourg</option>
  <option>Macao</option>
  <option>Madagascar</option>
  <option>Malawi</option>
  <option>Malaysia</option>
  <option>Maldives</option>
  <option>Mali</option>
  <option>Malta</option>
  <option>Marshall Islands</option>
  <option>Martinique</option>
  <option>Mauritania</option>
  <option>Mauritius</option>
  <option>Mayotte</option>
  <option>Mexico</option>
  <option>Micronesia (Federated States of)</option>
  <option>Moldova, Republic of</option>
  <option>Monaco</option>
  <option>Mongolia</option>
  <option>Montenegro</option>
  <option>Montserrat</option>
  <option>Morocco</option>
  <option>Mozambique</option>
  <option>Myanmar</option>
  <option>Namibia</option>
  <option>Nauru</option>
  <option>Nepal</option>
  <option>Netherlands</option>
  <option>New Caledonia</option>
  <option>New Zealand</option>
  <option>Nicaragua</option>
  <option>Niger</option>
  <option>Nigeria</option>
  <option>Niue</option>
  <option>Norfolk Island</option>
  <option>North Macedonia</option>
  <option>Northern Mariana Islands</option>
  <option>Norway</option>
  <option>Oman</option>
  <option>Pakistan</option>
  <option>Palau</option>
  <option>Palestine, State of</option>
  <option>Panama</option>
  <option>Papua New Guinea</option>
  <option>Paraguay</option>
  <option>Peru</option>
  <option>Philippines</option>
  <option>Pitcairn</option>
  <option>Poland</option>
  <option>Portugal</option>
  <option>Puerto Rico</option>
  <option>Qatar</option>
  <option>Réunion</option>
  <option>Romania</option>
  <option>Russian Federation</option>
  <option>Rwanda</option>
  <option>Saint Barthélemy</option>
  <option>Saint Helena, Ascension and Tristan da Cunha</option>
  <option>Saint Kitts and Nevis</option>
  <option>Saint Lucia</option>
  <option>Saint Martin (French part)</option>
  <option>Saint Pierre and Miquelon</option>
  <option>Saint Vincent and the Grenadines</option>
  <option>Samoa</option>
  <option>San Marino</option>
  <option>Sao Tome and Principe</option>
  <option>Saudi Arabia</option>
  <option>Senegal</option>
  <option>Serbia</option>
  <option>Seychelles</option>
  <option>Sierra Leone</option>
  <option>Singapore</option>
  <option>Sint Maarten (Dutch part)</option>
  <option>Slovakia</option>
  <option>Slovenia</option>
  <option>Solomon Islands</option>
  <option>Somalia</option>
  <option>South Africa</option>
  <option>South Georgia and the South Sandwich Islands</option>
  <option>South Sudan</option>
  <option>Spain</option>
  <option>Sri Lanka</option>
  <option>Sudan</option>
  <option>Suriname</option>
  <option>Svalbard and Jan Mayen</option>
  <option>Sweden</option>
  <option>Switzerland</option>
  <option>Syrian Arab Republic</option>
  <option>Taiwan, Province of China</option>
  <option>Tajikistan</option>
  <option>Tanzania, United Republic of</option>
  <option>Thailand</option>
  <option>Timor-Leste</option>
  <option>Togo</option>
  <option>Tokelau</option>
  <option>Tonga</option>
  <option>Trinidad and Tobago</option>
  <option>Tunisia</option>
  <option>Turkey</option>
  <option>Turkmenistan</option>
  <option>Turks and Caicos Islands</option>
  <option>Tuvalu</option>
  <option>Uganda</option>
  <option>Ukraine</option>
  <option>United Arab Emirates</option>
  <option>United Kingdom of Great Britain and Northern Ireland</option>
  <option>United States Minor Outlying Islands</option>
  <option>United States of America</option>
  <option>Uruguay</option>
  <option>Uzbekistan</option>
  <option>Vanuatu</option>
  <option>Venezuela (Bolivarian Republic of)</option>
  <option>Viet Nam</option>
  <option>Virgin Islands (British)</option>
  <option>Virgin Islands (U.S.)</option>
  <option>Wallis and Futuna</option>
  <option>Western Sahara</option>
  <option>Yemen</option>
  <option>Zambia</option>
  <option>Zimbabwe</option>
</datalist>

<datalist id="countrydata2">
  <option value="Afghanistan" />
  <option value="Åland Islands" />
  <option value="Albania" />
  <option value="Algeria" />
  <option value="American Samoa" />
  <option value="Andorra" />
  <option value="Angola" />
  <option value="Anguilla" />
  <option value="Antarctica" />
  <option value="Antigua and Barbuda" />
  <option value="Argentina" />
  <option value="Armenia" />
  <option value="Aruba" />
  <option value="Australia" />
  <option value="Austria" />
  <option value="Azerbaijan" />
  <option value="Bahamas" />
  <option value="Bahrain" />
  <option value="Bangladesh" />
  <option value="Barbados" />
  <option value="Belarus" />
  <option value="Belgium" />
  <option value="Belize" />
  <option value="Benin" />
  <option value="Bermuda" />
  <option value="Bhutan" />
  <option value="Bolivia (Plurinational State of)" />
  <option value="Bonaire, Sint Eustatius and Saba" />
  <option value="Bosnia and Herzegovina" />
  <option value="Botswana" />
  <option value="Bouvet Island" />
  <option value="Brazil" />
  <option value="British Indian Ocean Territory" />
  <option value="Brunei Darussalam" />
  <option value="Bulgaria" />
  <option value="Burkina Faso" />
  <option value="Burundi" />
  <option value="Cabo Verde" />
  <option value="Cambodia" />
  <option value="Cameroon" />
  <option value="Canada" />
  <option value="Cayman Islands" />
  <option value="Central African Republic" />
  <option value="Chad" />
  <option value="Chile" />
  <option value="China" />
  <option value="Christmas Island" />
  <option value="Cocos (Keeling) Islands" />
  <option value="Colombia" />
  <option value="Comoros" />
  <option value="Congo" />
  <option value="Congo, Democratic Republic of the" />
  <option value="Cook Islands" />
  <option value="Costa Rica" />
  <option value="Côte d'Ivoire" />
  <option value="Croatia" />
  <option value="Cuba" />
  <option value="Curaçao" />
  <option value="Cyprus" />
  <option value="Czechia" />
  <option value="Denmark" />
  <option value="Djibouti" />
  <option value="Dominica" />
  <option value="Dominican Republic" />
  <option value="Ecuador" />
  <option value="Egypt" />
  <option value="El Salvador" />
  <option value="Equatorial Guinea" />
  <option value="Eritrea" />
  <option value="Estonia" />
  <option value="Eswatini" />
  <option value="Ethiopia" />
  <option value="Falkland Islands (Malvinas)" />
  <option value="Faroe Islands" />
  <option value="Fiji" />
  <option value="Finland" />
  <option value="France" />
  <option value="French Guiana" />
  <option value="French Polynesia" />
  <option value="French Southern Territories" />
  <option value="Gabon" />
  <option value="Gambia" />
  <option value="Georgia" />
  <option value="Germany" />
  <option value="Ghana" />
  <option value="Gibraltar" />
  <option value="Greece" />
  <option value="Greenland" />
  <option value="Grenada" />
  <option value="Guadeloupe" />
  <option value="Guam" />
  <option value="Guatemala" />
  <option value="Guernsey" />
  <option value="Guinea" />
  <option value="Guinea-Bissau" />
  <option value="Guyana" />
  <option value="Haiti" />
  <option value="Heard Island and McDonald Islands" />
  <option value="Holy See" />
  <option value="Honduras" />
  <option value="Hong Kong" />
  <option value="Hungary" />
  <option value="Iceland" />
  <option value="India" />
  <option value="Indonesia" />
  <option value="Iran (Islamic Republic of)" />
  <option value="Iraq" />
  <option value="Ireland" />
  <option value="Isle of Man" />
  <option value="Israel" />
  <option value="Italy" />
  <option value="Jamaica" />
  <option value="Japan" />
  <option value="Jersey" />
  <option value="Jordan" />
  <option value="Kazakhstan" />
  <option value="Kenya" />
  <option value="Kiribati" />
  <option value="Korea (Democratic People's Republic of)" />
  <option value="Korea, Republic of" />
  <option value="Kuwait" />
  <option value="Kyrgyzstan" />
  <option value="Lao People's Democratic Republic" />
  <option value="Latvia" />
  <option value="Lebanon" />
  <option value="Lesotho" />
  <option value="Liberia" />
  <option value="Libya" />
  <option value="Liechtenstein" />
  <option value="Lithuania" />
  <option value="Luxembourg" />
  <option value="Macao" />
  <option value="Madagascar" />
  <option value="Malawi" />
  <option value="Malaysia" />
  <option value="Maldives" />
  <option value="Mali" />
  <option value="Malta" />
  <option value="Marshall Islands" />
  <option value="Martinique" />
  <option value="Mauritania" />
  <option value="Mauritius" />
  <option value="Mayotte" />
  <option value="Mexico" />
  <option value="Micronesia (Federated States of)" />
  <option value="Moldova, Republic of" />
  <option value="Monaco" />
  <option value="Mongolia" />
  <option value="Montenegro" />
  <option value="Montserrat" />
  <option value="Morocco" />
  <option value="Mozambique" />
  <option value="Myanmar" />
  <option value="Namibia" />
  <option value="Nauru" />
  <option value="Nepal" />
  <option value="Netherlands" />
  <option value="New Caledonia" />
  <option value="New Zealand" />
  <option value="Nicaragua" />
  <option value="Niger" />
  <option value="Nigeria" />
  <option value="Niue" />
  <option value="Norfolk Island" />
  <option value="North Macedonia" />
  <option value="Northern Mariana Islands" />
  <option value="Norway" />
  <option value="Oman" />
  <option value="Pakistan" />
  <option value="Palau" />
  <option value="Palestine, State of" />
  <option value="Panama" />
  <option value="Papua New Guinea" />
  <option value="Paraguay" />
  <option value="Peru" />
  <option value="Philippines" />
  <option value="Pitcairn" />
  <option value="Poland" />
  <option value="Portugal" />
  <option value="Puerto Rico" />
  <option value="Qatar" />
  <option value="Réunion" />
  <option value="Romania" />
  <option value="Russian Federation" />
  <option value="Rwanda" />
  <option value="Saint Barthélemy" />
  <option value="Saint Helena, Ascension and Tristan da Cunha" />
  <option value="Saint Kitts and Nevis" />
  <option value="Saint Lucia" />
  <option value="Saint Martin (French part)" />
  <option value="Saint Pierre and Miquelon" />
  <option value="Saint Vincent and the Grenadines" />
  <option value="Samoa" />
  <option value="San Marino" />
  <option value="Sao Tome and Principe" />
  <option value="Saudi Arabia" />
  <option value="Senegal" />
  <option value="Serbia" />
  <option value="Seychelles" />
  <option value="Sierra Leone" />
  <option value="Singapore" />
  <option value="Sint Maarten (Dutch part)" />
  <option value="Slovakia" />
  <option value="Slovenia" />
  <option value="Solomon Islands" />
  <option value="Somalia" />
  <option value="South Africa" />
  <option value="South Georgia and the South Sandwich Islands" />
  <option value="South Sudan" />
  <option value="Spain" />
  <option value="Sri Lanka" />
  <option value="Sudan" />
  <option value="Suriname" />
  <option value="Svalbard and Jan Mayen" />
  <option value="Sweden" />
  <option value="Switzerland" />
  <option value="Syrian Arab Republic" />
  <option value="Taiwan, Province of China" />
  <option value="Tajikistan" />
  <option value="Tanzania, United Republic of" />
  <option value="Thailand" />
  <option value="Timor-Leste" />
  <option value="Togo" />
  <option value="Tokelau" />
  <option value="Tonga" />
  <option value="Trinidad and Tobago" />
  <option value="Tunisia" />
  <option value="Turkey" />
  <option value="Turkmenistan" />
  <option value="Turks and Caicos Islands" />
  <option value="Tuvalu" />
  <option value="Uganda" />
  <option value="Ukraine" />
  <option value="United Arab Emirates" />
  <option value="United Kingdom of Great Britain and Northern Ireland" />
  <option value="United States Minor Outlying Islands" />
  <option value="United States of America" />
  <option value="Uruguay" />
  <option value="Uzbekistan" />
  <option value="Vanuatu" />
  <option value="Venezuela (Bolivarian Republic of)" />
  <option value="Viet Nam" />
  <option value="Virgin Islands (British)" />
  <option value="Virgin Islands (U.S.)" />
  <option value="Wallis and Futuna" />
  <option value="Western Sahara" />
  <option value="Yemen" />
  <option value="Zambia" />
  <option value="Zimbabwe" />
</datalist>

<datalist id="countrydata3">
  <option value="AF">Afghanistan</option>
  <option value="AX">Åland Islands</option>
  <option value="AL">Albania</option>
  <option value="DZ">Algeria</option>
  <option value="AS">American Samoa</option>
  <option value="AD">Andorra</option>
  <option value="AO">Angola</option>
  <option value="AI">Anguilla</option>
  <option value="AQ">Antarctica</option>
  <option value="AG">Antigua and Barbuda</option>
  <option value="AR">Argentina</option>
  <option value="AM">Armenia</option>
  <option value="AW">Aruba</option>
  <option value="AU">Australia</option>
  <option value="AT">Austria</option>
  <option value="AZ">Azerbaijan</option>
  <option value="BS">Bahamas</option>
  <option value="BH">Bahrain</option>
  <option value="BD">Bangladesh</option>
  <option value="BB">Barbados</option>
  <option value="BY">Belarus</option>
  <option value="BE">Belgium</option>
  <option value="BZ">Belize</option>
  <option value="BJ">Benin</option>
  <option value="BM">Bermuda</option>
  <option value="BT">Bhutan</option>
  <option value="BO">Bolivia (Plurinational State of)</option>
  <option value="BQ">Bonaire, Sint Eustatius and Saba</option>
  <option value="BA">Bosnia and Herzegovina</option>
  <option value="BW">Botswana</option>
  <option value="BV">Bouvet Island</option>
  <option value="BR">Brazil</option>
  <option value="IO">British Indian Ocean Territory</option>
  <option value="BN">Brunei Darussalam</option>
  <option value="BG">Bulgaria</option>
  <option value="BF">Burkina Faso</option>
  <option value="BI">Burundi</option>
  <option value="CV">Cabo Verde</option>
  <option value="KH">Cambodia</option>
  <option value="CM">Cameroon</option>
  <option value="CA">Canada</option>
  <option value="KY">Cayman Islands</option>
  <option value="CF">Central African Republic</option>
  <option value="TD">Chad</option>
  <option value="CL">Chile</option>
  <option value="CN">China</option>
  <option value="CX">Christmas Island</option>
  <option value="CC">Cocos (Keeling) Islands</option>
  <option value="CO">Colombia</option>
  <option value="KM">Comoros</option>
  <option value="CG">Congo</option>
  <option value="CD">Congo, Democratic Republic of the</option>
  <option value="CK">Cook Islands</option>
  <option value="CR">Costa Rica</option>
  <option value="CI">Côte d'Ivoire</option>
  <option value="HR">Croatia</option>
  <option value="CU">Cuba</option>
  <option value="CW">Curaçao</option>
  <option value="CY">Cyprus</option>
  <option value="CZ">Czechia</option>
  <option value="DK">Denmark</option>
  <option value="DJ">Djibouti</option>
  <option value="DM">Dominica</option>
  <option value="DO">Dominican Republic</option>
  <option value="EC">Ecuador</option>
  <option value="EG">Egypt</option>
  <option value="SV">El Salvador</option>
  <option value="GQ">Equatorial Guinea</option>
  <option value="ER">Eritrea</option>
  <option value="EE">Estonia</option>
  <option value="SZ">Eswatini</option>
  <option value="ET">Ethiopia</option>
  <option value="FK">Falkland Islands (Malvinas)</option>
  <option value="FO">Faroe Islands</option>
  <option value="FJ">Fiji</option>
  <option value="FI">Finland</option>
  <option value="FR">France</option>
  <option value="GF">French Guiana</option>
  <option value="PF">French Polynesia</option>
  <option value="TF">French Southern Territories</option>
  <option value="GA">Gabon</option>
  <option value="GM">Gambia</option>
  <option value="GE">Georgia</option>
  <option value="DE">Germany</option>
  <option value="GH">Ghana</option>
  <option value="GI">Gibraltar</option>
  <option value="GR">Greece</option>
  <option value="GL">Greenland</option>
  <option value="GD">Grenada</option>
  <option value="GP">Guadeloupe</option>
  <option value="GU">Guam</option>
  <option value="GT">Guatemala</option>
  <option value="GG">Guernsey</option>
  <option value="GN">Guinea</option>
  <option value="GW">Guinea-Bissau</option>
  <option value="GY">Guyana</option>
  <option value="HT">Haiti</option>
  <option value="HM">Heard Island and McDonald Islands</option>
  <option value="VA">Holy See</option>
  <option value="HN">Honduras</option>
  <option value="HK">Hong Kong</option>
  <option value="HU">Hungary</option>
  <option value="IS">Iceland</option>
  <option value="IN">India</option>
  <option value="ID">Indonesia</option>
  <option value="IR">Iran (Islamic Republic of)</option>
  <option value="IQ">Iraq</option>
  <option value="IE">Ireland</option>
  <option value="IM">Isle of Man</option>
  <option value="IL">Israel</option>
  <option value="IT">Italy</option>
  <option value="JM">Jamaica</option>
  <option value="JP">Japan</option>
  <option value="JE">Jersey</option>
  <option value="JO">Jordan</option>
  <option value="KZ">Kazakhstan</option>
  <option value="KE">Kenya</option>
  <option value="KI">Kiribati</option>
  <option value="KP">Korea (Democratic People's Republic of)</option>
  <option value="KR">Korea, Republic of</option>
  <option value="KW">Kuwait</option>
  <option value="KG">Kyrgyzstan</option>
  <option value="LA">Lao People's Democratic Republic</option>
  <option value="LV">Latvia</option>
  <option value="LB">Lebanon</option>
  <option value="LS">Lesotho</option>
  <option value="LR">Liberia</option>
  <option value="LY">Libya</option>
  <option value="LI">Liechtenstein</option>
  <option value="LT">Lithuania</option>
  <option value="LU">Luxembourg</option>
  <option value="MO">Macao</option>
  <option value="MG">Madagascar</option>
  <option value="MW">Malawi</option>
  <option value="MY">Malaysia</option>
  <option value="MV">Maldives</option>
  <option value="ML">Mali</option>
  <option value="MT">Malta</option>
  <option value="MH">Marshall Islands</option>
  <option value="MQ">Martinique</option>
  <option value="MR">Mauritania</option>
  <option value="MU">Mauritius</option>
  <option value="YT">Mayotte</option>
  <option value="MX">Mexico</option>
  <option value="FM">Micronesia (Federated States of)</option>
  <option value="MD">Moldova, Republic of</option>
  <option value="MC">Monaco</option>
  <option value="MN">Mongolia</option>
  <option value="ME">Montenegro</option>
  <option value="MS">Montserrat</option>
  <option value="MA">Morocco</option>
  <option value="MZ">Mozambique</option>
  <option value="MM">Myanmar</option>
  <option value="NA">Namibia</option>
  <option value="NR">Nauru</option>
  <option value="NP">Nepal</option>
  <option value="NL">Netherlands</option>
  <option value="NC">New Caledonia</option>
  <option value="NZ">New Zealand</option>
  <option value="NI">Nicaragua</option>
  <option value="NE">Niger</option>
  <option value="NG">Nigeria</option>
  <option value="NU">Niue</option>
  <option value="NF">Norfolk Island</option>
  <option value="MK">North Macedonia</option>
  <option value="MP">Northern Mariana Islands</option>
  <option value="NO">Norway</option>
  <option value="OM">Oman</option>
  <option value="PK">Pakistan</option>
  <option value="PW">Palau</option>
  <option value="PS">Palestine, State of</option>
  <option value="PA">Panama</option>
  <option value="PG">Papua New Guinea</option>
  <option value="PY">Paraguay</option>
  <option value="PE">Peru</option>
  <option value="PH">Philippines</option>
  <option value="PN">Pitcairn</option>
  <option value="PL">Poland</option>
  <option value="PT">Portugal</option>
  <option value="PR">Puerto Rico</option>
  <option value="QA">Qatar</option>
  <option value="RE">Réunion</option>
  <option value="RO">Romania</option>
  <option value="RU">Russian Federation</option>
  <option value="RW">Rwanda</option>
  <option value="BL">Saint Barthélemy</option>
  <option value="SH">Saint Helena, Ascension and Tristan da Cunha</option>
  <option value="KN">Saint Kitts and Nevis</option>
  <option value="LC">Saint Lucia</option>
  <option value="MF">Saint Martin (French part)</option>
  <option value="PM">Saint Pierre and Miquelon</option>
  <option value="VC">Saint Vincent and the Grenadines</option>
  <option value="WS">Samoa</option>
  <option value="SM">San Marino</option>
  <option value="ST">Sao Tome and Principe</option>
  <option value="SA">Saudi Arabia</option>
  <option value="SN">Senegal</option>
  <option value="RS">Serbia</option>
  <option value="SC">Seychelles</option>
  <option value="SL">Sierra Leone</option>
  <option value="SG">Singapore</option>
  <option value="SX">Sint Maarten (Dutch part)</option>
  <option value="SK">Slovakia</option>
  <option value="SI">Slovenia</option>
  <option value="SB">Solomon Islands</option>
  <option value="SO">Somalia</option>
  <option value="ZA">South Africa</option>
  <option value="GS">South Georgia and the South Sandwich Islands</option>
  <option value="SS">South Sudan</option>
  <option value="ES">Spain</option>
  <option value="LK">Sri Lanka</option>
  <option value="SD">Sudan</option>
  <option value="SR">Suriname</option>
  <option value="SJ">Svalbard and Jan Mayen</option>
  <option value="SE">Sweden</option>
  <option value="CH">Switzerland</option>
  <option value="SY">Syrian Arab Republic</option>
  <option value="TW">Taiwan, Province of China</option>
  <option value="TJ">Tajikistan</option>
  <option value="TZ">Tanzania, United Republic of</option>
  <option value="TH">Thailand</option>
  <option value="TL">Timor-Leste</option>
  <option value="TG">Togo</option>
  <option value="TK">Tokelau</option>
  <option value="TO">Tonga</option>
  <option value="TT">Trinidad and Tobago</option>
  <option value="TN">Tunisia</option>
  <option value="TR">Turkey</option>
  <option value="TM">Turkmenistan</option>
  <option value="TC">Turks and Caicos Islands</option>
  <option value="TV">Tuvalu</option>
  <option value="UG">Uganda</option>
  <option value="UA">Ukraine</option>
  <option value="AE">United Arab Emirates</option>
  <option value="GB">United Kingdom of Great Britain and Northern Ireland</option>
  <option value="UM">United States Minor Outlying Islands</option>
  <option value="US">United States of America</option>
  <option value="UY">Uruguay</option>
  <option value="UZ">Uzbekistan</option>
  <option value="VU">Vanuatu</option>
  <option value="VE">Venezuela (Bolivarian Republic of)</option>
  <option value="VN">Viet Nam</option>
  <option value="VG">Virgin Islands (British)</option>
  <option value="VI">Virgin Islands (U.S.)</option>
  <option value="WF">Wallis and Futuna</option>
  <option value="EH">Western Sahara</option>
  <option value="YE">Yemen</option>
  <option value="ZM">Zambia</option>
  <option value="ZW">Zimbabwe</option>
</datalist>

<datalist id="countrydata4">
  <option value="AF" label="Afghanistan" />
  <option value="AX" label="Åland Islands" />
  <option value="AL" label="Albania" />
  <option value="DZ" label="Algeria" />
  <option value="AS" label="American Samoa" />
  <option value="AD" label="Andorra" />
  <option value="AO" label="Angola" />
  <option value="AI" label="Anguilla" />
  <option value="AQ" label="Antarctica" />
  <option value="AG" label="Antigua and Barbuda" />
  <option value="AR" label="Argentina" />
  <option value="AM" label="Armenia" />
  <option value="AW" label="Aruba" />
  <option value="AU" label="Australia" />
  <option value="AT" label="Austria" />
  <option value="AZ" label="Azerbaijan" />
  <option value="BS" label="Bahamas" />
  <option value="BH" label="Bahrain" />
  <option value="BD" label="Bangladesh" />
  <option value="BB" label="Barbados" />
  <option value="BY" label="Belarus" />
  <option value="BE" label="Belgium" />
  <option value="BZ" label="Belize" />
  <option value="BJ" label="Benin" />
  <option value="BM" label="Bermuda" />
  <option value="BT" label="Bhutan" />
  <option value="BO" label="Bolivia (Plurinational State of)" />
  <option value="BQ" label="Bonaire, Sint Eustatius and Saba" />
  <option value="BA" label="Bosnia and Herzegovina" />
  <option value="BW" label="Botswana" />
  <option value="BV" label="Bouvet Island" />
  <option value="BR" label="Brazil" />
  <option value="IO" label="British Indian Ocean Territory" />
  <option value="BN" label="Brunei Darussalam" />
  <option value="BG" label="Bulgaria" />
  <option value="BF" label="Burkina Faso" />
  <option value="BI" label="Burundi" />
  <option value="CV" label="Cabo Verde" />
  <option value="KH" label="Cambodia" />
  <option value="CM" label="Cameroon" />
  <option value="CA" label="Canada" />
  <option value="KY" label="Cayman Islands" />
  <option value="CF" label="Central African Republic" />
  <option value="TD" label="Chad" />
  <option value="CL" label="Chile" />
  <option value="CN" label="China" />
  <option value="CX" label="Christmas Island" />
  <option value="CC" label="Cocos (Keeling) Islands" />
  <option value="CO" label="Colombia" />
  <option value="KM" label="Comoros" />
  <option value="CG" label="Congo" />
  <option value="CD" label="Congo, Democratic Republic of the" />
  <option value="CK" label="Cook Islands" />
  <option value="CR" label="Costa Rica" />
  <option value="CI" label="Côte d'Ivoire" />
  <option value="HR" label="Croatia" />
  <option value="CU" label="Cuba" />
  <option value="CW" label="Curaçao" />
  <option value="CY" label="Cyprus" />
  <option value="CZ" label="Czechia" />
  <option value="DK" label="Denmark" />
  <option value="DJ" label="Djibouti" />
  <option value="DM" label="Dominica" />
  <option value="DO" label="Dominican Republic" />
  <option value="EC" label="Ecuador" />
  <option value="EG" label="Egypt" />
  <option value="SV" label="El Salvador" />
  <option value="GQ" label="Equatorial Guinea" />
  <option value="ER" label="Eritrea" />
  <option value="EE" label="Estonia" />
  <option value="SZ" label="Eswatini" />
  <option value="ET" label="Ethiopia" />
  <option value="FK" label="Falkland Islands (Malvinas)" />
  <option value="FO" label="Faroe Islands" />
  <option value="FJ" label="Fiji" />
  <option value="FI" label="Finland" />
  <option value="FR" label="France" />
  <option value="GF" label="French Guiana" />
  <option value="PF" label="French Polynesia" />
  <option value="TF" label="French Southern Territories" />
  <option value="GA" label="Gabon" />
  <option value="GM" label="Gambia" />
  <option value="GE" label="Georgia" />
  <option value="DE" label="Germany" />
  <option value="GH" label="Ghana" />
  <option value="GI" label="Gibraltar" />
  <option value="GR" label="Greece" />
  <option value="GL" label="Greenland" />
  <option value="GD" label="Grenada" />
  <option value="GP" label="Guadeloupe" />
  <option value="GU" label="Guam" />
  <option value="GT" label="Guatemala" />
  <option value="GG" label="Guernsey" />
  <option value="GN" label="Guinea" />
  <option value="GW" label="Guinea-Bissau" />
  <option value="GY" label="Guyana" />
  <option value="HT" label="Haiti" />
  <option value="HM" label="Heard Island and McDonald Islands" />
  <option value="VA" label="Holy See" />
  <option value="HN" label="Honduras" />
  <option value="HK" label="Hong Kong" />
  <option value="HU" label="Hungary" />
  <option value="IS" label="Iceland" />
  <option value="IN" label="India" />
  <option value="ID" label="Indonesia" />
  <option value="IR" label="Iran (Islamic Republic of)" />
  <option value="IQ" label="Iraq" />
  <option value="IE" label="Ireland" />
  <option value="IM" label="Isle of Man" />
  <option value="IL" label="Israel" />
  <option value="IT" label="Italy" />
  <option value="JM" label="Jamaica" />
  <option value="JP" label="Japan" />
  <option value="JE" label="Jersey" />
  <option value="JO" label="Jordan" />
  <option value="KZ" label="Kazakhstan" />
  <option value="KE" label="Kenya" />
  <option value="KI" label="Kiribati" />
  <option value="KP" label="Korea (Democratic People's Republic of)" />
  <option value="KR" label="Korea, Republic of" />
  <option value="KW" label="Kuwait" />
  <option value="KG" label="Kyrgyzstan" />
  <option value="LA" label="Lao People's Democratic Republic" />
  <option value="LV" label="Latvia" />
  <option value="LB" label="Lebanon" />
  <option value="LS" label="Lesotho" />
  <option value="LR" label="Liberia" />
  <option value="LY" label="Libya" />
  <option value="LI" label="Liechtenstein" />
  <option value="LT" label="Lithuania" />
  <option value="LU" label="Luxembourg" />
  <option value="MO" label="Macao" />
  <option value="MG" label="Madagascar" />
  <option value="MW" label="Malawi" />
  <option value="MY" label="Malaysia" />
  <option value="MV" label="Maldives" />
  <option value="ML" label="Mali" />
  <option value="MT" label="Malta" />
  <option value="MH" label="Marshall Islands" />
  <option value="MQ" label="Martinique" />
  <option value="MR" label="Mauritania" />
  <option value="MU" label="Mauritius" />
  <option value="YT" label="Mayotte" />
  <option value="MX" label="Mexico" />
  <option value="FM" label="Micronesia (Federated States of)" />
  <option value="MD" label="Moldova, Republic of" />
  <option value="MC" label="Monaco" />
  <option value="MN" label="Mongolia" />
  <option value="ME" label="Montenegro" />
  <option value="MS" label="Montserrat" />
  <option value="MA" label="Morocco" />
  <option value="MZ" label="Mozambique" />
  <option value="MM" label="Myanmar" />
  <option value="NA" label="Namibia" />
  <option value="NR" label="Nauru" />
  <option value="NP" label="Nepal" />
  <option value="NL" label="Netherlands" />
  <option value="NC" label="New Caledonia" />
  <option value="NZ" label="New Zealand" />
  <option value="NI" label="Nicaragua" />
  <option value="NE" label="Niger" />
  <option value="NG" label="Nigeria" />
  <option value="NU" label="Niue" />
  <option value="NF" label="Norfolk Island" />
  <option value="MK" label="North Macedonia" />
  <option value="MP" label="Northern Mariana Islands" />
  <option value="NO" label="Norway" />
  <option value="OM" label="Oman" />
  <option value="PK" label="Pakistan" />
  <option value="PW" label="Palau" />
  <option value="PS" label="Palestine, State of" />
  <option value="PA" label="Panama" />
  <option value="PG" label="Papua New Guinea" />
  <option value="PY" label="Paraguay" />
  <option value="PE" label="Peru" />
  <option value="PH" label="Philippines" />
  <option value="PN" label="Pitcairn" />
  <option value="PL" label="Poland" />
  <option value="PT" label="Portugal" />
  <option value="PR" label="Puerto Rico" />
  <option value="QA" label="Qatar" />
  <option value="RE" label="Réunion" />
  <option value="RO" label="Romania" />
  <option value="RU" label="Russian Federation" />
  <option value="RW" label="Rwanda" />
  <option value="BL" label="Saint Barthélemy" />
  <option value="SH" label="Saint Helena, Ascension and Tristan da Cunha" />
  <option value="KN" label="Saint Kitts and Nevis" />
  <option value="LC" label="Saint Lucia" />
  <option value="MF" label="Saint Martin (French part)" />
  <option value="PM" label="Saint Pierre and Miquelon" />
  <option value="VC" label="Saint Vincent and the Grenadines" />
  <option value="WS" label="Samoa" />
  <option value="SM" label="San Marino" />
  <option value="ST" label="Sao Tome and Principe" />
  <option value="SA" label="Saudi Arabia" />
  <option value="SN" label="Senegal" />
  <option value="RS" label="Serbia" />
  <option value="SC" label="Seychelles" />
  <option value="SL" label="Sierra Leone" />
  <option value="SG" label="Singapore" />
  <option value="SX" label="Sint Maarten (Dutch part)" />
  <option value="SK" label="Slovakia" />
  <option value="SI" label="Slovenia" />
  <option value="SB" label="Solomon Islands" />
  <option value="SO" label="Somalia" />
  <option value="ZA" label="South Africa" />
  <option value="GS" label="South Georgia and the South Sandwich Islands" />
  <option value="SS" label="South Sudan" />
  <option value="ES" label="Spain" />
  <option value="LK" label="Sri Lanka" />
  <option value="SD" label="Sudan" />
  <option value="SR" label="Suriname" />
  <option value="SJ" label="Svalbard and Jan Mayen" />
  <option value="SE" label="Sweden" />
  <option value="CH" label="Switzerland" />
  <option value="SY" label="Syrian Arab Republic" />
  <option value="TW" label="Taiwan, Province of China" />
  <option value="TJ" label="Tajikistan" />
  <option value="TZ" label="Tanzania, United Republic of" />
  <option value="TH" label="Thailand" />
  <option value="TL" label="Timor-Leste" />
  <option value="TG" label="Togo" />
  <option value="TK" label="Tokelau" />
  <option value="TO" label="Tonga" />
  <option value="TT" label="Trinidad and Tobago" />
  <option value="TN" label="Tunisia" />
  <option value="TR" label="Turkey" />
  <option value="TM" label="Turkmenistan" />
  <option value="TC" label="Turks and Caicos Islands" />
  <option value="TV" label="Tuvalu" />
  <option value="UG" label="Uganda" />
  <option value="UA" label="Ukraine" />
  <option value="AE" label="United Arab Emirates" />
  <option value="GB" label="United Kingdom of Great Britain and Northern Ireland" />
  <option value="UM" label="United States Minor Outlying Islands" />
  <option value="US" label="United States of America" />
  <option value="UY" label="Uruguay" />
  <option value="UZ" label="Uzbekistan" />
  <option value="VU" label="Vanuatu" />
  <option value="VE" label="Venezuela (Bolivarian Republic of)" />
  <option value="VN" label="Viet Nam" />
  <option value="VG" label="Virgin Islands (British)" />
  <option value="VI" label="Virgin Islands (U.S.)" />
  <option value="WF" label="Wallis and Futuna" />
  <option value="EH" label="Western Sahara" />
  <option value="YE" label="Yemen" />
  <option value="ZM" label="Zambia" />
  <option value="ZW" label="Zimbabwe" />
</datalist>
              
            
!

CSS

              
                body {
  font-family: sans-serif;
  font-size: 100%;
  color: #222;
  background-color: #fafafe;
  margin: 1em;
}

label, button {
  display: block;
  margin-top: 1em;
}
              
            
!

JS

              
                (() => {

  // stop form submission and output field names/values to console
  const form = document.getElementById('autoform');

  form.addEventListener('submit', e => {
    e.preventDefault();
    console.clear();
    console.log('Submit disabled. Data:');

    const data = new FormData(form);
    for (let nv of data.entries()) {
      console.log(`  ${ nv[0] }: ${ nv[1] }`);
    }

  });

})();
              
            
!
999px

Console