Edit in JSFiddle

$(initialize);

var names=["Alex", "Andrew", "Andrea", "Anna", "Abbie", "Abraham", "Aisha", "Albert", "Albina", "Alisha", "Barbie", "Bailey", "Barton", "Bernardo", "Blaise", "Bobbie", "Blossom", "Brianna", "Buddy", "Byron", "Caesar", "Caleb", "Celicia", "Chalmer", "Chandra", "Cindi", "Clarence", "Codie", "Corey", "Cyrus"];

function initialize(){
    var textBox = $("#txtName");
    textBox.autocomplete({
        minLength: 2,
        source: function(request, response){
            var filteredNames = _.take(_.filter(names, function(name){
                return name.toLowerCase().indexOf(request.term.toLowerCase()) != -1;
            }), textBox.data("count"));
            response(filteredNames);
        }
    });
}
<div id="ui-widget">
    Enter name: <input type="text" id="txtName" data-count="5" placeholder="Your name..." />
</div>

              
            
          
            
              

External resources loaded into this fiddle: