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
1 Réponse
+ 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());
});