假设我有一个字符列表:
+ * & # @如何在jquery中读取它们,以便在keypress上禁用它们?
$(document).on("keydown", ".quick-edit", function(e) {
if (e.keyCode == &) {
return false;
}
});要重新表达我的问题,我想从字符串charCode &中了解
发布于 2013-11-01 17:01:39
e.which将为按下的键提供同源化代码,然后可以使用禁用的密钥数组来防止默认操作。
var disabled = [55, 107, 106]
$(document).on("keydown", ".quick-edit", function (e) {
console.log(e.which)
if($.inArray(e.which, disabled)!=-1){
e.preventDefault()
}
});发布于 2013-11-01 18:56:40
我找到了解决办法。
charcodeat.asp
var str = "$";
var n = str.charCodeAt(0);https://stackoverflow.com/questions/19731490
复制相似问题