Last active
August 29, 2015 14:27
-
-
Save hattmarris/d092c0fd1d39fd08dca0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// define example vars | |
var dataList = document.getElementById('suggestions'), | |
letters = 'abcdefghijklmnopqrstuvwxyz', | |
choices = letters.split(''), | |
doubled = []; | |
// doubled letters | |
for(var i in choices) { | |
var s = choices[i] + choices[i]; | |
doubled.push(s); | |
} | |
choices = choices.concat(doubled); | |
// populate datalist HTML5 method | |
// loop and add permutations of letters as options | |
for(var i=0; i<choices.length; i++) { | |
var option = document.createElement('option'); | |
option.value = choices[i]; | |
dataList.appendChild(option); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment