-
-
Save codingwithsara/fba2fee8a0136117fc97c75f355beebb to your computer and use it in GitHub Desktop.
jQuery UI Tutorial - Auto Complete Form -
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>jQuery Auto Complete</title> | |
<style> | |
.container { | |
margin: 100px auto; | |
text-align: center; | |
} | |
#inputField { | |
width: 300px; | |
height: 40px; | |
font-size: 18px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<h2>Auto Complete Form</h2> | |
<input type="text" id="inputField"> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script> | |
<script> | |
$(function(){ | |
var data = [ | |
"Cake - Banana", | |
"Cake - Carrot", | |
"Cake - Strawberry", | |
"Candy - Apple", | |
"Candy - Orange", | |
"Candy - Strawberry", | |
"Juice - Apple", | |
"Juice - Carrot", | |
"Juice - Grape", | |
"Juice - Orange" | |
]; | |
$("#inputField").autocomplete({ | |
source:data | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment