I'm using contenteditable divs instead of input elements, because they are more flexible when it comes to styling within the input box. I'm just wondering if there's a way to make the input look like an input element with its type set to password, like so:
<input type='password'>
I hope that is clear enough. Thanks.
you will have to find out the browser specific CSS settings for mozilla and co.. but in webkit it looks like this. also you need to add the keypress handler via javascript for it.
<style>
#password {
-webkit-text-security: disc;
height:20px; width:100px;
-webkit-appearance: textfield;
padding: 1px;
background-color: white;
border: 2px inset;
-webkit-user-select: text;
cursor: auto;
}
</style>
<div id="password" contenteditable="true">yourpassword</div>
<script>
//you could use javascript to do nice stuff
var fakepassw=document.getElementById('password');
//fakepassw.contentEditable="true";
fakepassw.addEventListener('focus',function(e){ /*yourcode*/ },false);
fakepassw.addEventListener('keyup',function(e){ console.log(e.keyCode) },false);
</script>
but anyway, password fields are just combined elements with element.innerHTML="yourpassword"
and element.innerText="•••••••"
you could do this with javascript too and fill innerText with "•"