Answer the question
In order to leave comments, you need to log in
How to get synchronous printing?
here i have this code
var input = $("input");
var p = $("p");
input.on('keyup',function(){
var val = input.val();
p.text(val);
});
Answer the question
In order to leave comments, you need to log in
Firstly, Google Translator expresses your thoughts more clearly, and secondly, put a keydown event.
now I know how English-speaking people see my questions on stackoverflow))
on the topic, try the input propertychange event
input.on('input propertychange', function() {
var val = $(this).val();
p.text(val);
});
Vladimir is right. put a keydown event handler, paste
the new character will be in the event that jquery passes
$(function(){
var input = $("input");
var p = $("p");
input.on('keydown paste',function(e){
var newval = input.val()+String.fromCharCode(e.keyCode);
p.text(newval);
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question