$(document).ready(function() { BindControls(); //catsub(); }); function BindControls() { var Countries = [ "Delhi NCR ", ]; var limit = 15; $('#location').autocomplete({ source: function(request, response) { var results = $.ui.autocomplete.filter(Countries, request.term); response(results.slice(0, limit)); }, minLength: 0, scroll: false, }).click(function() { $(this).autocomplete("search", ""); }); //$('#searchfield').trigger('focus'); } $( '#location' ).autocomplete({ select: function( event, ui ) { $('#searchfield').trigger('focus'); //onchangesetCity(ui.item.label); } }); function catsub() { var Countries = [ "Tour Operators", "Tour Operators Agents For Domestic", "Tour Operators Agets For International", "Tour Operators Agents", "Air Ticketing", "Air Ticketing Agents For Domestic", "Air Ticketing Agets For International", "Air Ticketing Agents", "Car Hire", "Car Hire For Local", "Car Hire For Out Station", "Bus Hire", "Bus Hire For Local", "Bus Hire For Out Station", "Bus Ticketing", "Bus Ticketing Agents", "Railway Ticketing", "Railway Ticketing Agents", "Visa Assistance", "Visa Assistance For Usa", "Money Exchange", "Money Exchange Services", "Hotel Reservation", "Hotel Reservation Agents For Domestic", "Hotel Reservation Agets For International", "Resort Booking", "Resort Booking Agents", "Resort Booking Services", "Domestic Travel Agents", "International Travel Agents", "Property Dealers", "Property Dealers For Residential", ]; var limit = 10; $('#searchfield').autocomplete({ source: function(request, response) { var results = $.ui.autocomplete.filter(Countries, request.term); response(results.slice(0, limit)); }, minLength: 0, scroll: false }).focus(function() { $(this).autocomplete("search", ""); }); } function onchangesetCity(Id){ $.ajax({ type: "Post", data:"id=" + Id + "& type=" + "select" , url: "gelcurrentLocation.php", success: function (html) { //alert(html); window.location = ''; return false; }, error: function (e) { } }); }