At least one number in input field (jQuery)

2019-09-19 18:56发布

问题:

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