javascript - HTML terminal like text input -


i trying have form field (just normal html text input box) can typed in , have value changed renders text invisible.

i need box visible visibility: hidden; or display: none; won't trick.

i can't make text same color background because background not single color. need text invisible while rest of input remains visible.

the effect trying achieve when type password in terminal , accepts input shows no feedback (this not password though).

i can't make text same color background because background not single color.

what transparent color?

does help?

input[type="text"] {   color: transparent; } 

jsbin demo #1


update:

i implemented @shomz idea, can keep cursor @ beginning or change characters *. i've used jquery bind 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 javascript version? sure!

that's long story, check demo.

jsbin demo #3


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -