如何在文本框中禁用alt键代码? [英] How to disable alt key codes in textbox?

查看:93
本文介绍了如何在文本框中禁用alt键代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。



请帮帮我。我需要在文本框中禁用alt +键代码来限制某些特殊字符,例如%。



谢谢!

Hi, All.

Please help me. I need to disable alt + key codes in the textbox to restrict some special characters like %.

Thank you!

推荐答案


' selector')。keypress(function(e){
console.log(e.shiftKey);
if ((.altKey){
e.preventDefault();
alert( ' 不允许');
}
});
('selector').keypress(function(e) { console.log(e.shiftKey); if ((.altKey) { e.preventDefault(); alert('Disallowed'); } });


您只需要禁用 alt 键,其余是执行特定操作的组合:

You just need to disable only the alt key, rest is a combination to perform specific operation:


这篇关于如何在文本框中禁用alt键代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆