0

Why this happens???

HTML: <input type="text" id="name"/> <div id="msg"></div> JQuery: $("#name").keydown(function() { $("#msg").html($("#name").val()); }); When i run this code, entered text in textbox, it will print previous letter, not current letter. (last letter is not get printed) e.g: sdb sd

23rd Apr 2017, 6:49 PM
Sandip Bhambre (Sandy)
Sandip Bhambre (Sandy) - avatar
1 Respuesta
+ 5
use keyup this event is for when a key is released checked and worked <input type="text" id="name"/> <div id="msg"></div> $("#name").keyup(function() { $("#msg").html($("#name").val()); });
23rd Apr 2017, 7:16 PM
Burey
Burey - avatar