本文介绍了如何使var提示只接受字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在制作一个简单的网站。对于第一个变量提示,在'delivery'功能下,我希望用户输入一个名称。我已经设置了它,所以他们不仅可以输入数字,但是当用户输入数字和字母的组合时,它仍然接受它,并继续该程序。
我想只接受信件。
我该怎么做?
谢谢!
Hi, I am making a simple website. For the first variable prompt, under the 'delivery' function, I would like the user to input a name. I've already set it up, so they cannot only enter numbers, but when the user enters a combination of number and letters, it still accepts it, and continues with the program.
I would like to to only accept letters.
How can I do this?
Thanks!
Link to code
推荐答案
var letters = /^[a-zA-Z]+
这篇关于如何使var提示只接受字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!