I'm starting to get familiar with jQuery. Watching a mini video guide .
There, at the 7th minute, an example is demonstrated when we input something into input and this text is transmitted / fits into another block of code with a certain id'shnik. But when we transfer text from input with keypress, the last typed character is not transmitted. If you change the event to keyup, then everything becomes normal.
Made a simple likeness and yes, it works.
$(document).ready(function(){ $('input').keypress(function(){ $('span').text(', ' + $(this).val()) }); }); <form action=""> <input type="text" placeholder="Введите текст" id="text"> </form> <p>Привет<span id="userName"></span>!</p> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script> Actually, why is the last character not "transmitted" at the keypress event? After all, keypress is when we press and release a key on the keyboard, and when we type text into input, in any case we completely press the key and release.