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

  • Home
  • SEARCH
  • 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 599331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:29:12+00:00 2026-05-13T16:29:12+00:00

So I have 2 inputs. Both are for an autocomplete. I also have 2

  • 0

So I have 2 inputs. Both are for an “autocomplete”. I also have 2 functions that do pretty much the same thing… Each input calls a different function onBlur. The problem is that the second upon selecting a “suggestion” for the second input, it populates the first. What can I do to make the second one populate the second?

There’s probably a better way of doing it but my jQuery/Javascript Knowledge is limited and I’m running out of time… Thanks!

The code:

function fillLocation(thisValue) {
    $('#location-box').val(thisValue);
    setTimeout("$('#suggestionsLocation').fadeOut('fast');", 200);
}

function fillTerms(thisValue) {
    $('#terms-box').val(thisValue);
    setTimeout("$('#suggestionsTerms').fadeOut('fast');", 200);
}


<input type="text" name="search_location" id="location-box" value="" onkeyup="suggestLocation(this.value);" onblur="fillLocation();" autocomplete="off" />

<input type="text" name="search_terms" id="terms-box" value="" onkeyup="suggestTerms(this.value);" onblur="fillTerms();" autocomplete="off" />
  • 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-05-13T16:29:13+00:00Added an answer on May 13, 2026 at 4:29 pm

    I guess I’m assuming you want to trigger keyup and blur events for both inputs that have similar functionality, and that will both in turn affect the same input.

    This would be one way. Bind the events in javascript, not HTML, and run the proper code

    $('document').ready(function() {
    
        $('#location-box,#terms-box')
                        .bind('keyup', function() {
                               // do your keyup thing using $(this)
                               // to refer back to the input
                               //$('body').append($(this).attr('id') + ': keyup<br />');
                               var theValue = $(this).val();
                         }) 
                         .bind('blur', function() {
                               // do your blur thing using $(this)
                               // to refer back to the input
                               //$('body').append($(this).attr('id') + ': blur<br />');
                         })
        });
    
    
    <input type="text" name="search_location" id="location-box" value="" autocomplete="off" />
    <input type="text" name="search_terms" id="terms-box" value="" autocomplete="off" />
    

    EDIT:

    Uncomment the $(‘body’) lines to see the events in action.

    Hope this is what you were looking for.

    EDIT: Added to code to the keyup event to retrieve the value

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

Sidebar

Ask A Question

Stats

  • Questions 297k
  • Answers 298k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The resizeable interface is generated by adding DIVs to the… May 13, 2026 at 7:25 pm
  • Editorial Team
    Editorial Team added an answer The other answers are correct: this is fundamentally impossible. Probably… May 13, 2026 at 7:25 pm
  • Editorial Team
    Editorial Team added an answer Use Curses or ANSI escape sequences. Before you start spouting… May 13, 2026 at 7:25 pm

Related Questions

A week ago I would have done this manually: subset dataframe by group to
I have started to learn ANTLR and have both the 2007 book The Definitive
I have a sandboxed Applet, but that should not make a difference. The Applet
I have SQL Server 2008 and VS 2008 Pro. And I am coding in
can best help me systematically modify the replace field of a regex search as

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.