My requirement is on a keypress I need to get the value of the particular textbox. But the problem is when I press the first letter am getting a blank output. on second keypress am getting the first letter which I have entered in the textbox. Form here on Its getting a one step delay. Is am missing anything.
<script>
document.addEventListener('keypress',function(e){
var keycode = e.keyCode || e.which;
if(document.activeElement.id == 'k_id_234'){
console.log(document.getElementById('k_id_234').value);
}
});
</script>
<input type="text" id="k_id_234">
Text Box : h console : // empty
Text Box : he console : h //only first letter
....
......