I have an input field, where user has to add his address, but I need to get at least one number (house number). How should I validate that field ? Thanks in advance for any help.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Answering the question, to see if a string contains at least one number :
if ( string.match(/\d/) ) {
// do something
}
FIDDLE