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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:27:52+00:00 2026-06-15T11:27:52+00:00

Hello I recently coded this script with a help from some tutorials. The problem

  • 0

Hello I recently coded this script with a help from some tutorials.
The “problem” is that i want to be able to manually inserting names. As it is now if i type in a name witch does not exsist in db, and click away of the input field, it erases the text i typed in automaticly. I wan’t the manually typed in text to be there and the suggestions div must fade out if a user clicks away of the input or uses tab.

<script type="text/javascript">
    function lookup(inputString) {
        if(inputString.length == 0) {
            // Hide the suggestion box.
            $('#suggestions').hide();
        } else {
            $.post("../autofill_institution.php", {queryString: ""+inputString+""}, function(data){
                if(data.length > 0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);
                }
            });
        }
    } // lookup

    function fill(thisValue) {
            $('#inputString').val(thisValue);
            setTimeout("$('#suggestions').hide();", 200);
    }
</script>
  • 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-15T11:27:53+00:00Added an answer on June 15, 2026 at 11:27 am

    To hide the suggestion list when the input looses focus you can do something like this

    $("idoftheinputfield").on("blur",function(e){
        $('#suggestions').hide()
    })
    

    It leaves me pondering why your input field is getting cleared when the focus is lost. Anyways if you want to retain the manually typed value you can tweak it a bit like this:

    $("idoftheinputfield").on("blur",function(e){
        var mycurrentvalue = $(this).val();
        $(this).val(mycurrentvalue);
        $('#suggestions').hide()
    })
    

    Hope this helps..

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

Sidebar

Related Questions

Hello I recently posted this question but very badly explained the problem, but i'll
Hello everybody I've recently asked this question and I've given up with the 'replace
Introduction Hello folks, I recently learned to program in C! (This was a huge
Hello I am trying to solve this problem for past 5 hours now my
Hello recently I am using sweet pages pagination for my website. I want to
Hello I recently asked some questions on linked lists in C. The link was
Recently, when trying to compile java programs from the command prompt, I get this
Hello I have recently created a C program for my UNI Computing course that
Hello StackOverflow community! I started to learn Node.js recently, and decided to implement a
Hello, I want to put custom status bar in notification window of iphone. is

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.