jeudi 16 avril 2015

what is the difference between keypress event and real keyboard key press?


Vote count:

0




I fill a form field with the following code, but It doesn't change ng-pristine to ng-dirty.



$("#username").keypress(function(event) {
var key = event.keyCode || event.which;
$('#username').val($('#username').val() + String.fromCharCode(key));
});
$('#username').trigger(jQuery.Event('keypress', {which: 77}));


is there any function that exactly simulate a real keyboard key press?



asked 2 mins ago

Salman

219






what is the difference between keypress event and real keyboard key press?

Aucun commentaire:

Enregistrer un commentaire