我不能这样使用对象原型吗?
Object.prototype.keyPressed = function(){
var key = (this.keyCode ? this.keyCode : this.which);
return key;
};
$(document).on('keypress'), function(e){
if (e.keyPressed() != 13) return;
});
我不能这样使用对象原型吗?
Object.prototype.keyPressed = function(){
var key = (this.keyCode ? this.keyCode : this.which);
return key;
};
$(document).on('keypress'), function(e){
if (e.keyPressed() != 13) return;
});