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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:47:44+00:00 2026-06-13T17:47:44+00:00

I am using jQuery’s autocomplete and I have it set up in the following

  • 0

I am using jQuery’s autocomplete and I have it set up in the following way

$('#id').autocomplete({
        source: function (request, response) {
            $.ajax({
                url: 'myurl'
            , type: 'POST'
            , dataType: 'json'
            , data: { 'query': request.term }
            , success: function (data) {
                response($.map(data, function (item) {
                    return { label: item, value: item };
                }));
            }
            });
        },
        delay: 300,
        minLength: 2,
        close: function (event, ui) { doAjaxStuffNow() },
        change: function (event, ui) { doAjaxStuffNow() }
    });

I am using both the close and the change function because of the timing I want to achieve with the ajax call. I want it to execute when the menu closes or, in the event that the menu never opens, when the field is blurred. The problem is that it fired twice if the menu closes and then the field is blurred so I was wondering if anyone knew of a way to achieve the effect of close xor change.

Thanks,
Tom

  • 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-13T17:47:45+00:00Added an answer on June 13, 2026 at 5:47 pm

    You can accomplish this using the focus and blur methods to determine if the value changed.

    $("#combo_input_id").focus(function() {
        oldval = $(this).val();
        }).blur(function(){
            if(oldval != $(this).val()){
                doAjaxStuffNow();
            };
            return false;
        });
    

    It isn’t very pretty, but it gets the job done. I hope future versions of jqueryui will trigger the change method even if the user never types input.

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

Sidebar

Related Questions

(using jquery) I have the following function $(function() { $('tr.parent') .css(cursor,pointer) .attr(title,Click to expand/collapse)
using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Using jQuery what's the way to get all elements of a queried set EXCEPT
Using jQuery , I can use the following function to execute code as soon
Using jQuery and using the ajax function, what causes it to use the error
Using Jquery , I have an array result [<a href=><img src=image1></a>,<a href=><img src=image2></a>] if
Using jQuery UI I have two radio buttons, Approve/Reject, which I would like to
Using jQuery validation - validating on blur: $('input, select, radio, checkbox').blur(function(){ $(#createAccount).validate().element(this); }); If
Using jQuery, what would be the most efficient way to find the first two
Using jQuery, I need to select all elements that do not have a background

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.