Jquery how to add last typed character

javascript, jquery, keydown

Solution

you should use the event keyup and not keydown.

Then it should work.

Problem

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?

Original source