Convert text in a text box to password bullets on keyup [duplicate]

272
December 10, 2016, at 1:29 PM

This question already has an answer here:

  • How do I disable the save password bubble in chrome using Javascript? 8 answers

I have a "Enter your pin" field in a page. I have kept the input type for this field as password. The problem is that when a user clicks on the submit button, the browser asks to save the password(which I don't want). I have tried autocomplete="off" as well but it didn't work either.

The other solution that I have been trying is that I keep the input type as text and convert the text into password bullets as a user enters the text(onkeyup) with jquery. I have a variable in which I want to store the value of the pin. Now if I keep feeding the value of the input to the variable on every keyup event, and then convert the character into password bullet instantaneously, the value of the variable on the next keyup event will also include the password bullets that had been converted in the previous iteration.

The other long way is to get the value of each character entered in the input and append it to the variable. But then this process becomes too long and I will also have to handle key presses such as "backspace", "delete", "tab".

All I really want is to get the pin entered and the browser should not ask to save it

Any help will be really really appreciated.

Answer 1
<input type="textbox" id="UserID" />
<input type="password" style="display:none"/>
<input type="textbox" id="password" />
<script>
  function init() {
       $('#password').replaceWith('<input type="password" id="password" />');
  }     
</script>
READ ALSO
How to apply Quill.js to an already content editable element?

How to apply Quill.js to an already content editable element?

I have to use the Delta and Event features of Quilljs to provide some contextual dropdowns on specific keywords within the Gmail Composer (on gmail

366
JS Check Jquery inArray

JS Check Jquery inArray

I would like to use a onchange state on a select element to check if the value of the select is in an array

449
No jumping drag/resize Dialog in scrolled window/area?

No jumping drag/resize Dialog in scrolled window/area?

How to normal resize & drag UI Dialog in scrolled window/area?

313
How to get md5 iterated md5 sum of every chunk, using blueimp jquery upload plugin

How to get md5 iterated md5 sum of every chunk, using blueimp jquery upload plugin

I have to calculate and send a iterated md5-hash to my upload-apiBut i donĀ“t know how

523