Home > Web Front-end > JS Tutorial > jquery tutorial restricts the text box to only input numbers and decimal points example sharing_jquery

jquery tutorial restricts the text box to only input numbers and decimal points example sharing_jquery

WBOY
Release: 2016-05-16 17:03:57
Original
1071 people have browsed it

Copy code The code is as follows:

$(function(){                                                  Limit the text box to only numbers*/
$(".NumText").keyup(function(){
^0/g,''));
                                                                                                            . .replace(/D|^0/g,''));                                                                                                             *JQuery limits the text box to only numbers and decimal points*/
$(".NumDecText").keyup(function(){
(/[^0-9.]/g,''));                                                                                                                                 (this).val().replace(/[^0-9.]/g,''));  
       }).css("ime-mode", "disabled"); //CSS setting input Method not available                                                           
Then add the class name to the text box that needs to be verified, similar to the following:




Copy the code


The code is as follows:


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template