Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <h1>People</h1>
- <label for="name">Choose your name from the list:</label>
- <input list="names" name="name" id="name" onchange="checkExists(this.value)" autocomplete="off" autofocus>
- <datalist id="names">
- <option value="Liam">
- <option value="Noah">
- <option value="Oliver">
- <option value="William">
- <option value="Elijah">
- <option value="James">
- <option value="Benjamin">
- <option value="Lucas">
- <option value="Mason">
- <option value="Ethan">
- <option value="Alexander">
- <option value="Henry">
- <option value="Jacob">
- <option value="Michael">
- <option value="Daniel">
- <option value="Logan">
- <option value="Jackson">
- <option value="Sebastian">
- <option value="Jack">
- <option value="Aiden">
- <option value="Owen">
- <option value="Samuel">
- <option value="Matthew">
- <option value="Joseph">
- <option value="Levi">
- <option value="Mateo">
- <option value="David">
- <option value="John">
- <option value="Wyatt">
- <option value="Carter">
- <option value="Julian">
- <option value="Griffin">
- <option value="Kenneth">
- <option value="Israel">
- <option value="Javier">
- <option value="Kyler">
- <option value="Jax">
- <option value="Amari">
- <option value="Zane">
- <option value="Emilio">
- <option value="Knox">
- <option value="Adonis">
- <option value="Aidan">
- <option value="Kaden">
- <option value="Paul">
- <option value="Omar">
- <option value="Brian">
- <option value="Louis">
- <option value="Caden">
- <option value="Maximiliano">
- <option value="Holden">
- <option value="Paxton">
- <option value="Nash">
- <option value="Gunner">
- <option value="Jake">
- <option value="Hayes">
- <option value="Manuel">
- <option value="Prince">
- <option value="Bodhi">
- <option value="Cohen">
- </datalist>
- </body>
- <script>
- function checkExists(inputValue) {
- var x = document.getElementById("names");
- var i;
- var flag;
- for (i = 0; i < x.options.length; i++) {
- if(inputValue == x.options[i].value){
- flag = true;
- alert(inputValue);
- }
- }
- return flag;
- }
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement