Cecil
Cecil

Reputation: 1619

Javascript - Masking a password on a JS alert box

I have the following

var validate=prompt("Enter your PIN","Enter your PIN");

This works fine except it shows the password when typing it.

Is there any way to mask the password being entered?

Cheers,

Upvotes: 1

Views: 10974

Answers (3)

pohchen
pohchen

Reputation: 1823

It's impossible to hide the password.JS load on the client side. We can easily find the password by checking the source code.

Here is an example. Check it out yourself http://www.pageresource.com/jscript/jpass.htm

Upvotes: 0

amitchd
amitchd

Reputation: 975

If you really want a prompt window and accept a password, you might want to use this plugin along with jquery. Check out example 9 on http://trentrichardson.com/Impromptu/index.php and use type="password" instead.

Upvotes: 0

Sarfraz
Sarfraz

Reputation: 382726

Nope, there is no way to mask prompt box. You will have to use some other custom solution or use password input box instead.

If you want to do validation of password, do it on the server-side not client-side.

Upvotes: 3

Related Questions