0

I want to re-invent the password input in HTML.

Okay, here is the work I'd done:

http://www.symplik.com/password.html (It just a plain html code, nothing really fancy :>)

The "password" is indeed a text input, and I used the onkeyup event to rewrite the input to masking characters.

There're two problems: (1) backspace or delete cannot be detected (2) if I type very fast, some characters cannot be captured promptly.

For problem (1). it is partially solved by checking the length of text in the password field and the stored password. Not a very elegant solution anyway.

For problem (2), I'd tried to insert some time delay function in between but still fail. I'd make the field readOnly after every keyUp but it still behaves the same.

2
  • 6
    I would strongly recommend against this. It defeats any security precautions the OS might take with password fields. Commented May 22, 2009 at 21:48
  • Doing this just for aesthetic reasons, is not worth lowering the security. +1up for Chuck Commented May 25, 2009 at 14:18

1 Answer 1

7

Why not use

<input type='password'>

It masks the input for you. No need for javascript.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.