Home >Web Front-end >JS Tutorial >Example of jquery prohibiting the input of characters other than numbers (pure numeric verification code)_jquery

Example of jquery prohibiting the input of characters other than numbers (pure numeric verification code)_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:52:531335browse

Used when using purely numerical verification codes, they are organized as follows:

Copy code The code is as follows:

$('#mobile-vcode').unbind( );
$("#mobile-vcode").bind("keyup change",function () {
$(this).val($(this).val().replace(/D/ g,''));
if($(this).val().length==4){
/*ajax checks whether the verification code is correct, and activates the button if it is correct*/
}
});
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn