JSFiddle - React, Tailwind, and code Playground

by Philippe Xantus

HTML

<input type="text" id="country" />

JavaScript

$(document).ready(function(){
    // Creating an array with country names and load them into local storage
    var countries = new Array();
    countries = ['Afghanistan','Albania','Algeria','Andorra','Angola','Antigua and Barbuda','Argentina','Armenia','Aruba','Australia','Austria','Azerbaijan'];
    localStorage.setItem('countries',JSON.stringify(countries));
    // Adding autocmplete functionality to a textfield with data from local storage
    $('#country').autocomplete({source:JSON.parse(localStorage.getItem('countries')), minLength:1, delay:0});
});