As simple as possible is to use CSS -webkit-text-security
You can use the values none
, square
, circle
or disc
.
Example below using circle
:
function Foo() {
frm = document.getElementById("frm");
document.getElementById("bar").innerHTML = frm["foo"].value;
//console.log(frm["foo"].value);
}
input.foo { -webkit-text-security: circle; }
<form id="frm" action="" method="POST">
<input type="text" name="foo" class="foo" size="15">
<input type="button" value="clique para ver o texto real" onclick="Foo();">
</form>
<br><div id="bar"></div>
The part in JavaScript is only for tests with didactic purpose, to display the actual text.