HI WELCOME TO KANSIRIS

jQuery Show All AutoComplete List / Options on Focus Example

Leave a Comment
To show all autocomplete options on focus in textbox using jQuery we need to write the code like as shown below


$('#txtUsers').autocomplete({
source: users,
minLength: 0
}).focus(function() {
$(this).autocomplete("search""");
});

If you want to full example to show autocomplete list on textbox focus in jQuery write the code like as shown below


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Show All AutoComplete Options on Focus Example</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.0-rc.2/themes/base/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.11.3.js"></script>
<script src="//code.jquery.com/ui/1.12.0-rc.2/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function(){
var users = ['Suresh Dasari',
'Rohini Alavala',
'Sudheer Rayana',
'Madhav Sai',
'Siva Prasad',
'Praveen Alavala',
'Sateesh Chandra',
'Mahendra Dasari'];

$('#txtUsers').autocomplete({
source: users,
minLength: 0
}).focus(function() {
$(this).autocomplete("search""");
});
})
</script>

</head>
<body>
<form id="form1">
<div>
Enter Name:<input type="text" id="txtUsers" placeholder="Focus in Textbox" style="padding:10px;width:250px" />
</div>
</form>
</body>
</html>

Demo

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.