Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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 datalist fallback</h1>

<p>Works in all browsers including IE9 and below which do not support datalist elements.</p>

<form id="autoform">

  <label for="country">country</label>
  
  <datalist id="countrydata">
    <select name="countryselect">
      <option></option>
      <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>
    </select>
      
    <label for="country">or other:</label>
    
  </datalist>
  
  <input list="countrydata" id="country" name="country" size="50" autocomplete="off" />
  
  <button type="submit">submit</button>

</form>
              
            
!

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