I'm trying to implement a auto complete feature that i found here on stack overflow jQuery UI AutoComplete: Only allow selected valued from suggested list
This is the jquery I'm using
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
This is my implementation
<div id="ServiceProvider">
<h3 style="background-color:#EA6A20 ;"><b>Please enter the name of the HR representative who provided service to you</b> </h3>
<input autocomplete="on" type="text" name="HRName" id="HRName" value=""></br></br>
<script>
var validOptions = ["First Last", "First1 Last1", "First2 Last2"]
previousValue = "";
$('#HRName').autocomplete({
autoFocus: true,
source: validOptions
}).keyup(function() {
var isValid = false;
for (i in validOptions) {
if (validOptions[i].toLowerCase().match(this.value.toLowerCase())) {
isValid = true;
}
}
if (!isValid) {
this.value = previousValue
} else {
previousValue = this.value;
}
});
</script>
</div>
The error i get is
Uncaught TypeError: Object [object Object] has no method 'autocomplete' Customer_Survery.php:266
(anonymous function) Customer_Survery.php:266
Thanks for the help