In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "jquery how form verification cannot be numeric". In daily operation, I believe that many people have doubts about how jquery form verification cannot be numeric. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubt that "jquery how form verification cannot be numeric". Next, please follow the editor to study!
Jquery form verification is not a number of methods: 1, use the val method to obtain the form value; 2, create a verification number of the regular expression "/ ^ [0-9] + $/"; 3, in the if statement to verify whether the form value matches the regular expression, the syntax is "if (regular expression object .test (form value)".
The operating environment of this tutorial: windows7 system, jquery1.10.0 version, Dell G3 computer.
The method that jquery form validation cannot be numeric
1. Create a new html file, named test.html, to explain how the jquery verification form cannot be written as a pure number. In the test.html file, create a form using the form tag, and within the form form, create an input box for the form using the input tag.
In the test.html file, in the form form, create a button with the button tag called validate member name.
In the test.html file, bind the onclick click event to the button button, and execute the yanzheng () function when the button is clicked.
2, in the js tag, create the yanzheng () function, in the function, get the input object through id (user), use the val () method to get its input member name, and save the member name in the user variable.
Within the yanzheng () function, create a regular expression "/ ^ [0-9] + $/" that validates numbers. In the if statement, verify whether the membership name matches the regular expression by the test () method, and if so, prompt "cannot be pure number".
3. Open the test.html file in the browser, enter the member name, and click the button to view the effect.
The regular expression "/ ^ [0-9] + $/" represents one or more numbers that begin with a number and end with a number.
At this point, the study on "how jquery form validation can not be numeric" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.