Jquery cannot pass the class verification form blank, jqueryclass
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.
<! DOCTYPE html>