简体   繁体   English

我需要一个无法按 javascript 中的字母键的文本框

[英]i need a textbox which do not able to press the alphabetic key in javascript

我需要一个文本框,它不能在 Java Script 中按字母键并删除输入的字符。

只需将此属性添加到您的输入:

onkeydown = "if(/[a-z]/i.test(String.fromCharCode((event||window.event).keyCode))){return false;}"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用JavaScript在TextBox中按Enter键 - Press Enter Key using JavaScript Inside a TextBox 如何使用JavaScript更新按键上的文本框 - How to update a textbox on key press using JavaScript 当我在 javascript 中按下前进键或后退键时,我需要一种执行特定功能的方法 - I Need a way to execute a particular function when i press the forward key or the back key in javascript laravel-如何触发输入文本框的按键以实现javascript代码 - laravel - How to trigger enter key press of textbox to implement javascript code 如何使用Javascript一次按退格键清除文本框? - How to clear a textbox on single press of Backspace key using Javascript? 如何在按键时将字符附加到 JavaScript 中文本框/文本区域中的选定文本 - How to append characters to selected text in textbox/textarea in JavaScript on key press 需要使用 javascript 识别使用哪个文本框 - Need to identify which textbox is used using javascript 按空格键时如何禁用用户文本框中的退格键? - How to disable the backspace key in user textbox when i press spacebar? 如何在按键上获取div的内容,使其也包含在该按键上输入的文本? - How do I get the content of the div on a key press so that it also includes the text which was entered on that keypress? 我需要按一个按钮来发推文 - I need to be able to press a button to tweet out a quote
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM