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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:35:04+00:00 2026-06-17T10:35:04+00:00

I would like to replace letters into numbers as they’re typed inside an <input

  • 0

I would like to replace letters into numbers as they’re typed inside an <input type="text"> box.

Currently I use this code:

function Auto(str) 
{
  var search = new Array(
    "q","w","e","r","t","y","u","i","o","p"
  );
  var replace = new Array(
    "1","2","3","4","5","6","7","8","9","0"
  );
  return str.replace(search, replace);
}

// me need make find in find_str but i dont know how…

$("#find").on('keypress',function(){
  find_str = $("#find").val();
  alert (Auto(find_str));
});

Tell me please how make find letter in find_str and how to write this code?

P.S.: alert() only for test.

  • 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-17T10:35:05+00:00Added an answer on June 17, 2026 at 10:35 am

    replace doesn’t do arrays. There are a couple of alternatives, like multiple replacements, but transliteration seems good:

    var map = {q: '1', w: '2', e: '3', r: '4', t: '5', y: '6', u: '7', i: '8', o: '9', p: '0'};
    var r = '';
    
    for(var i = 0; i < str.length; i++) {
        r += map[str.charAt(i)] || str.charAt(i);
    }
    
    return r;
    

    Also note that you’re probably going to run into some focus problems, which are really annoying for users, so avoid things like this if at all possible.

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

Sidebar

Related Questions

I have the following table and would like to replace the string text of
I would like to match single negated letters in some function and replace with
I have a text file with protein sequences. I would like to replace all
I would like to replace each two spaces from the beginning of each line,
I would like to replace drop down list (that has on change event that
I would like to replace the first character ' x ' with the number
I would like to replace blank spaces/white spaces in a string with commas. STR1=This
I would like to replace a part of the image with my image in
I would like to replace extra spaces (instances of consecutive whitespace characters) with one
I have such file and I would like to replace $GLOBALS['SERVER_MEMCACHED']='localhost'; with $GLOBALS['SERVER_MEMCACHED']='mydomain.com'; using

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.