I made this code:
$('.change').keydown(function(){
var value = $(this).val();
var id = $(this).attr('id');
$('.'+id).text(value);
});
It is working fine with 1 flaw. When i type something it doesn't update my last inserted character. So when i start typing "Test case" the div is filled alright although it stops with "Test cas". As you can see i am missing the last character.
How can i make this so that the last character is added?
you should use the event keyup and not keydown.
Then it should work.
Change the event to keyup
it will work...
$('.change').keyup(function(){
var value = $(this).val();
var id = $(this).attr('id');
$('.'+id).text(value);
});
Fiddle : http://jsfiddle.net/RYh7U/84/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With