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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:33:13+00:00 2026-05-31T05:33:13+00:00

Hello everyone i just picked up jQuery So my question is i want to

  • 0

Hello everyone i just picked up jQuery

So my question is i want to stop a key from repeating when you hold it down

Example: Edit (i want it to stop .. so 1 character per keypress/keydown)

keypress: a

HoldDown: aaaaaaaaaaaaaaaaaaaaaaaaaaaaa

My code is:

 <input type='text'>

var stop= false;
var time =null;
$(':text').keypress(function(e) {
if(stop === true){e.preventDefault();}
    if (time !== null) {
        lastkey = time;
    }
    time = new Date().getTime();
    var between = time - lastkey;
    if (between <= 70) {
        stop = true;
    }
});
$(':text').keyup(function(){stop = false;});

Am i going about this the wrong way?

  • 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-31T05:33:13+00:00Added an answer on May 31, 2026 at 5:33 am

    Try this: http://jsfiddle.net/maniator/yFA8c/

    It will only allow a letter per every 2 seconds.

    Code:

    var mult = false,
        prev = 0;
    
    $('.mult').keydown(function(e) {
        if (!mult) {
            mult = true;
            prev = e.which;
            setTimeout(function() {
                mult = false;
            }, 2000)
        }
        else if (prev != e.which) {
            mult = false;
        }
        else {
            return false;
        }
    })​;​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello everyone I am new to the forum and I just had a question
Hello everyone I'm trying to make a jquery Menu just like the one in
Hello everyone I was just going trough http://static.springsource.org/docs/Spring-MVC-step-by-step/part1.html spring tutorial, and I thought its
Hello everyone I have a problem. I want to do a GridView with a
Hello everyone I am just learning my first programming language and have just corrected
Hello everyone I have a question that I will describe as good as I
Hello everyone and thanks for reading. For means of QA, I want to setup
Hello everyone and thank you for your time. I would just like to say
hello everyone I am newto programming and I am just a little bit confused.
Hello everyone i am new to rails just wanted to ask What this line

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.