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 8287147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:57:19+00:00 2026-06-08T11:57:19+00:00

I am using jQuery Autocomplete to do a product lookup. I am using the

  • 0

I am using jQuery Autocomplete to do a product lookup. I am using the following code to enforce selection from a list:

$(".force-selection").blur(function(e) {
  var value = $(this).val();
  //check if the input's value matches the selected item
  alert($(this).val());
  alert($(this).data('selected-item'));
  if(value != $(this).data('selected-item')) {
    //they don't, the user must have typed something else
    $(this)
      .val('') //clear the input's text
      .data('selected-item', ''); //clear the selected item
  }
});

The above code ONLY works when the two alert statements are removed. Why would the behavior change based only upon the presence of a couple of alert statements?

  • 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-08T11:57:21+00:00Added an answer on June 8, 2026 at 11:57 am

    Try switching to use the Autocomplete change event instead of the blur event.

    • Either as an init option when creating the Autocomplete:

      $(".selector").autocomplete({
         change: function(event, ui) { ... }
      });
      
    • Or bind to the change event by type: autocompletechange.

      $(".selector").bind("autocompletechange", function(event, ui) {
         ...
      });
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jQuery autocomplete pluggin . I have the following code $().ready(function() {
I am using Jquery's autocomplete to retrieve a list of options from the mysql
I'm using jquery autocomplete and following view to display list of objects in inputfiled
I'm using jQuery autocomplete plugin from jQuery website calling the controller url which return
I am using jquery.autocomplete.js and jquery.apitags to select a few elements from a div
I am using Jquery autocomplete in my form. After selecting the value from autocomplete,
I'm using jQuery Autocomplete plugin which, generates following markup when suggestions show up. <ul
Very Brief Background: I am using Jquery Autocomplete to lookup the the value of
Ok guys working on search suggestions using jQuery-UI AutoComplete with results from sql-sever 2008
Using jQuery Autocomplete, according to the docs you have to do the following to

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.