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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:32:46+00:00 2026-06-14T19:32:46+00:00

So referencing this: How to delay the .keyup() handler until the user stops typing?

  • 0

So referencing this:
How to delay the .keyup() handler until the user stops typing?

I came up with the following code. But it does nothing… Any suggestions?

I am trying to get the setTimeout to cancel if the user types something further, so that multiple alerts don’t happen, only one when the user finally ‘stops’ (hopefully).

Thanks!!

var t = 0;  
$('input').keyup(function(){
    clearTimeout(t);
    t = setTimeout(alert($('input').val()),1000);
}
  • 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-14T19:32:48+00:00Added an answer on June 14, 2026 at 7:32 pm

    Replace

    t = setTimeout(alert($('input').val()),1000);
    

    with

    t = setTimeout(function(){alert($('input').val())},1000);
    

    You were passing the value of the input to setTimeout, while setTimeout needs a function (or a string it can evaluate as code) as first argument.

    And replace the last line with }); so that the code compiles.

    Demonstration

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

Sidebar

Related Questions

In forward referencing language such as c#, how does the compiler handle this? What
I really thought I understood Python variable referencing, so I'm confused why this code
Referencing this question: Is ASP.NET multithreaded (how does it execute requests) , would this
I am currently referencing this website for AD role management. The C# code is
Ey guys, I have been referencing this project, but I get this linker error:
Referencing this question/code: How do I copy a folder and all subfolders and files
Referencing this post: ruby on rails average per day I'm getting the average per
Referencing this Fiddle ( http://jsfiddle.net/j5uGN ), how can I toggle a clicked image's border
Having issues referencing $(this) from within a the nested ajax 'success' function... I know
Why is it that the this is not referencing the object, myObject ? When

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.