2

I have a predicament where I need a standard text input box to act like a password input without the type=password attribute.

The reason being is the app for a specific reason does not want password managers to be triggered by it.

Basically I was thinking

<script>
var mypw ="";
</script>

<input type="text" onkeydown="updatethis(this)"     onpaste="updatethis(this)">

After this I am lost, but somehow i want the pw to be stored in mypw and the input to just show a security char.

Again the need is very unique but I need to avoid password managers from triggering in this one scenario.

1
  • I need it to work in all browsers. Edge and ie don't support. Commented May 13, 2016 at 23:55

2 Answers 2

4

You mean something like?

input{
    -webkit-text-security: disc;
}
First name:<br>
<input type="text" name="firstname">

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

1 Comment

I need it to work in all browsers. Edge and ie do not support it.
0

I ended up changing the color and background to white, then mapped a divider right on top of it and updated in jquery.

                        <input class="noselect" type="text" id="password"
                            placeholder="Click2Mail Password" name="password" value="" onkeyUp="updatePW();"
                            required><div id="pwchar" onclick="$('#password').focus();" style="font-weight: 300;font-size:14px;position:absolute;top:0px;left:0;margin-top:12px;margin-left:38px;z-index:999999999999999999;"></div>

Here is the jquery

function updatePW()
{

    $("#pwchar").html($('#password').val().replace(/./g,"*"));
}

and last the css to make sure you cannot select the text in the box

#password{ -webkit-text-security: disc;background-color:#fff;color:#fff;
 }
.noselect {
    -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none;   /* Chrome/Safari/Opera */
  -khtml-user-select: none;    /* Konqueror */
  -moz-user-select: none;      /* Firefox */
  -ms-user-select: none;       /* Internet Explorer/Edge */
  user-select: none;           /* Non-prefixed version, currently
                                  not supported by any browser */

}

It's def not the perfect solution, but it works.

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.