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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:42:21+00:00 2026-06-15T23:42:21+00:00

I want to make a Javascript function that fires onkeyup event and its task

  • 0

I want to make a Javascript function that fires onkeyup event and its task is to call a main resolver function but only if no keys are fired for at least x milliseconds where x is the functions parameter.

For instance:

We have html code:

<body>
    <input type="text" id="suggestion" onkeyup="callMe(200);"/>
</body>

and Javascript something like:

<script type="text/javascript">
    function callMe(ms)
    {
        //wait at least x ms then call main logic function
        // e.g. doMain();
        alert("I've been called after timeout"); //for testing purposes
    }
</script>

So while I’m typing the alert won’t be called until you don’t type anything for at least x ms.

  • 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-15T23:42:22+00:00Added an answer on June 15, 2026 at 11:42 pm

    You can use a timer, you also need to clear the previous timer each time.

    To achieve this, better use “wrapper” function:

    <input type="text" id="suggestion" onkeyup="DelayedCallMe(200);"/>
    

    And the JavaScript:

    var _timer = 0;
    function DelayedCallMe(num) {
        if (_timer)
            window.clearTimeout(_timer);
        _timer = window.setTimeout(function() {
            callMe(num);
        }, 500);
    }
    

    This will execute the function 500 milliseconds after the last key up event.

    Live test case.

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

Sidebar

Related Questions

I have a method: myMethod() {} that I want to make accessible to javascript.
I have a main JavaScript file, we'll call core.js that other file are dependent
I have a javascript file and I want to call a function on the
I am traversing a HTML document using javascript DOM. I want make a list
I want to make a variable length array in Javascript. Is this possible. A
I want to make customer route for url which have parameters. <a href='javascript:void(0)' onclick=window.location='<?php
I want make interactive application where user launches it and can do various task
I have an external javascript file that I want to use to collect the
I want to make a substitute for javascript core confirm() in jquery ui dialog.I
I would like to write a JavaScript function that validates a zip code, by

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.