Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
How to let textbox only english can be input like type="password"?

For example , I have three input mode (Chinese , Japanese , English) When I input at the type = "password" , only English can be used and I can't change the input mode. Now I want my textbox like this but not use type = "password",only english mode can be used , how can I do it ?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

it is a component that you use everywhere

const MultiLangualInput= ({lan}) => {
    const EnglishMode = (event) => {
        let flag = false;
        var cahrcode = event.charCode;
        flag = (cahrcode == 32) ||
        (48 <= cahrcode && cahrcode <= 57) ||
        (65 <= cahrcode && cahrcode <= 90) ||
        (97 <= cahrcode && cahrcode <= 122);
        if (!flag)
            event.preventDefault();
    }
    const otherLanguage = (event) => {
        console.log(event.charCode)
        let flag = false;
        var cahrcode = event.charCode;
        flag = (cahrcode == 32) ||
        (48 <= cahrcode && cahrcode <= 57) ||
        (65 <= cahrcode && cahrcode <= 90) ||
        (1570 <= cahrcode && cahrcode <= 1594);
        if (!flag)
            event.preventDefault();
    }
    return (
        <Input onKeyPress={lan==='en'?EnglishMode:otherLanguage}>

        </Input>
    );
};

export default MultiLangualInput;

Like this:

const App = () => {

  return (
    <MultiLangualInput lan='en'>
        
    </MultiLangualInput>
  );
};
about 4 years ago · Juan Pablo Isaza Report

0

If I understand correctly something like this should work

in your HTML

<textarea name="textarea" rows="10" cols="50">Write something here</textarea>

in Javascript

let text = document.querySelector('textarea');

const pattern = /^[a-zA-Z0-9()*_\-!#$%^&*,."\'\][]+$/;

text.addEventListener('keyup',()=>{

  if(!pattern.test(text.value)) {
    alert('please use only latin letters')
  }

})```
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!