Auto Complete Textbox in Jquery
HTML & Jquery code:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.min.css"
rel="stylesheet"/>
<script>
$(document).ready(function(){
var carName = new Array();
carName.push("Volvo");
carName.push("Saab");
carName.push("Mercedes");
carName.push("Audi");
$('#txtName').autocomplete({source :carName});
});
</script>
</head>
<body>
<input
type="text" id="txtName"></input>
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</body>
</html>
Comments
Post a Comment