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

The Archive Base Latest Questions

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

Basically, im having a hard time getting the correct value from a jquery UI

  • 0

Basically, im having a hard time getting the correct value from a jquery UI input with a autocomplete at times. Iv created a jsfiddle to demonstrate the behavior. Hard to explain the exact issue, but here’s the fiddle:

http://jsfiddle.net/B4mXH/14/

To reproduce, follow these steps exactly, while having the browser dev tools js console open:

  1. focus on the text input
  2. move the mouse away from the input
  3. type c
  4. press arrow down on the keyboard to select “abc”
  5. hover over the option “cde”
  6. click the button.

error: I wont get any value. undefined is logged to the console.
expected: whatever value is inside the input box. please =)

If it matters, im using chrome.

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

    If you swap the change handler by a blur one it will work as intended:

    $('#autocomplete').blur(function(event, ui) {
        value = $(this).val();
    });
    

    I’m not sure why, but I assume the UI programmatically fires change events which affect the outcome of your stored value variable.

    Also, if you want to always get the current value of text input, you can query it when using it instead of storing it in a variable:

    $('#button').click(function() {
        console.log("clicked with : " + $('#autocomplete').val());
    });
    

    There may be some restriction on your project for you to not be using that yet, but it’s the most bulletproof method if you can use it.

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

Sidebar

Related Questions

I'm having a hard time getting XML values from an XML file using XPath.
I'm having a hard time with a selectManyCheckbox. Basically what I am doing is
I am having a hard time understanding the CommandTarget property for a RoutedCommand. Basically,
i'm having a hard time understanding custom events and I keep getting this same
I'm having a hard time figuring out why lseek doesn't work properly. Basically all
I'm having a hard time getting my head around what seems like an obvious
I am having a little bit of a hard time getting a CSS rule
I'm having a hard time getting what I want out of the python subprocess
I am having a really hard time getting this marshalling down. I have umanaged
I' having an hard time trying to understand COM apartments in outprocess environment. Basically

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.