Home >Web Front-end >JS Tutorial >jquery required method to determine whether the form is empty_jquery

jquery required method to determine whether the form is empty_jquery

WBOY
WBOYOriginal
2016-05-16 19:01:041245browse

html page

Copy code The code is as follows:












Select sender*
Send by city

Select sender 2*
Send by city


js code
Copy code The code is as follows:

<script><br>function checkForm() { <br>pass = true; <br>$("td:contains('*')").next().find("input").each(function (){ <br>if(this.value == '') { <br>text = $(this).parent().prev().text(); <br>alert(text " is required "); <br>this.focus(); <br>pass = false; <br>return false;//jump out of each <br>} <br>}); <br>return pass; <br>} <br></script>
Statement:
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