Jquery Form Verification passed class verification form is not blank _ jquery

Source: Internet
Author: User
When developing a system, some form data is usually required. If jQuery is used to verify the data by ID, it will not only affect the efficiency, but also cause some omissions and is not easy to maintain later. This chapter describes how to use jQuery to perform unified verification by configuring the class for the form. When developing a system, some form data is usually required. If jQuery is used to verify the data by ID, it will not only affect the efficiency, but also cause some omissions and is not easy to maintain later.

This chapter describes how to use jQuery to perform unified verification by configuring the class for the form. (ID can be used only once on a page; class can be referenced multiple times)

1: Add a class for input. The name can be set at will, but each input must be consistent. In this chapter, set calss to noNull. (If the input has a class attribute, it can be directly added to it)

2: add an attribute for input to obtain this field through jquery later and use it as a prompt. In this chapter, the case message is "notNull.

3: Use jQuery to traverse all forms whose calss is noNull and verify whether they are empty. If they are empty, a blank prompt is displayed by obtaining the notNull field.

For more information, see the following cases. This chapter describes the input, radio, select, and checkbox types.

  
   

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.