Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7873099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:24:47+00:00 2026-06-03T02:24:47+00:00

When using the jquery autocomplete plugin , what do you do when the user

  • 0

When using the jquery autocomplete plugin, what do you do when the user does not select an item in the list, but instead types a valid value and tabs away?

eg when the auto complete list contains:

Cat
Dog
Fish 

And the user types cat, but does not select Cat from the autocomplete’s dropdown list and instead tabs away. Because they did not select any item from the list, the autocomplete select event does not fire, and we lose the chance to respond to it:

$('#Animal').autocomplete({
    source: url,
    minlength: 1,
    select: function (event, ui) {
        $("#Animal").val(ui.item.value);
        changeUsersAnimal(ui.item.id);
    }
});

How do I handle this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:24:49+00:00Added an answer on June 3, 2026 at 2:24 am

    You’re probably looking for Scott González’ autoSelect extension. Just including this extension on the page will allow the select event to fire if the user enters a valid value and should require no changes on your end:

    /*
     * jQuery UI Autocomplete Auto Select Extension
     *
     * Copyright 2010, Scott González (http://scottgonzalez.com)
     * Dual licensed under the MIT or GPL Version 2 licenses.
     *
     * http://github.com/scottgonzalez/jquery-ui-extensions
     */
    (function( $ ) {
    
    $.ui.autocomplete.prototype.options.autoSelect = true;
    $( ".ui-autocomplete-input" ).live( "blur", function( event ) {
        var autocomplete = $( this ).data( "autocomplete" );
        if ( !autocomplete.options.autoSelect || autocomplete.selectedItem ) { return; }
    
        var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" );
        autocomplete.widget().children( ".ui-menu-item" ).each(function() {
            var item = $( this ).data( "item.autocomplete" );
            if ( matcher.test( item.label || item.value || item ) ) {
                autocomplete.selectedItem = item;
                return false;
            }
        });
        if ( autocomplete.selectedItem ) {
            autocomplete._trigger( "select", event, { item: autocomplete.selectedItem } );
        }
    });
    
    }( jQuery ));
    

    Here’s an example using the extension: http://jsfiddle.net/vFWUt/226/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write some JQuery using the AutoComplete plugin to display a list
I'm using the jQuery autocomplete plugin to get a list of locations, which works
I'm using the jQuery Autocomplete plugin from http://docs.jquery.com/Plugins/Autocomplete on IE7 and it's not releasing
I am using jQuery Tokeninput autocomplete plugin for the list of programming languages and
I'm using jQuery Autocomplete plugin 1.1 now, not the one included in jQuery UI.
i'm using this plugin for autocomplete http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete i want that when the user clicks
I was building something using jQuery's AutoComplete plugin last week, but today I found
I'm using jQuery autocomplete plugin from jQuery website calling the controller url which return
Let me clarify: I'm using standard jQuery autocomplete plugin (bassistanse.de) and bind it to
I'm using the following JQUERY Autocomplete plug-in: jQuery Plugin: Tokenizing Autocomplete Text Entry What'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.