cara mendeteksi kunci keyboard di js
With plain Javascript, the simplest is:
document.onkeypress = function (e) {
e = e || window.event;
// use e.keyCode or whatever you want
};
You can Use the following too in Plain JS:
document.addEventListener('keypress', function (e) {
e = e || window.event;
// use e.keyCode or whatever you want
});
With jQuery:
$(document).on("keypress", function (e) {
// use e.which
});
Expensive Eagle