I cannot just make the text the same color as the background, because the background is not the same color.
What about transparent color?
Does it help?
input[type="text"] { color: transparent; }
JSBin Demo # 1
Update:
I implemented @Shomz idea, you can just keep the cursor at the beginning or change all characters to * . I used jQuery to bind the event:
JQuery version:
var holder = [], exceptions = [13]; var hideChar = function(elm) { elm.value = ''; // Or // elm.value = elm.value.replace(/[^*]/, '*'); }; $('#console').keydown(function(e) { if (e.which === 8) { holder.pop(); } }).keypress(function(e) { if ($.inArray(e.which, exceptions) === -1) { holder.push(String.fromCharCode(e.which)); } var _this = this; setTimeout(function() { hideChar(_this); }, 1); }).keyup(function() { $('#holder').val(holder.join('')); });
HTML:
<input id="console" type="text" value=""> <input id="holder" type="hidden">
JSBin Demo # 2
Pure version of JavaScript? Sure!
This is a long story, check out the demo.
JSBin Demo # 3
source share