Reputation: 11448
I have the following in jquery code:
$(document).keypress(function (e) {
if (e.keyCode == 13) {
}
});
How can I make this into javascript so I do not need to load jquery everyime?
Upvotes: 2
Views: 124
Reputation: 342625
document.onkeypress = function (e) {
if (!e) var e = window.event;
var keyCode = e.keyCode || e.which;
if(keyCode == 13) {
}
...
}
Reading:
Upvotes: 5