<input type="text" onkeypress="SetText()" autocomplete="off" id="text" placeholder="Введите текст">
<div id="textpreview"></div>
<script>
function SetText(e) {
e = e || window.event;
document.getElementById('textpreview').innerHTML = document.getElementById('text').value + getChar(e);
}
function getChar(event) {
if (event.which == null) {
if (event.keyCode < 32) return null;
return String.fromCharCode(event.keyCode);
}
if (event.which!=0 && event.charCode!=0) {
if (event.which < 32) return null;
return String.fromCharCode(event.which);
}
return null;
}
</script>