Elements whose jquery submission value is not empty
Can be used for query
DetailsCode:
// When the query is executed, if the field in the form is empty, it will not be submitted $ ("# form1 "). submit (function () {try {$ (this ). find ("*"). each (function () {var ELEM = $ (this); If (ELEM. prop ("name ")! = NULL & ELEM. Prop ("name ")! = "") {If (ELEM. val () = "") {ELEM. removeattr ("name") ;}}) ;}catch (e) {alert (e) ;}return true ;});
Note that only one is returned. The form submit method takes the bool value. If one is not returned by default, it is void.
Principle: When a form is submitted, it is based on the name attribute of the element. As long as the name attribute is not added, It is not submitted.
The first step is to find all elements, that is, *, and then judge whether the name attribute is not null or not empty.
After the element is obtained, if the value is null, the name attribute is removed.