Home  >  Article  >  Web Front-end  >  How jQuery implements judgment when submitting a form_jquery

How jQuery implements judgment when submitting a form_jquery

WBOY
WBOYOriginal
2016-05-16 16:27:301776browse

The example in this article describes how jQuery implements judgment when form submission. Share it with everyone for your reference. The specific implementation method is as follows:

Copy code The code is as follows:

Replace with:
Copy code The code is as follows:

Use:

Copy code The code is as follows:
$("#myBtn").click(function(){
...//Judgment Verification
});

Form submission js:

Copy code The code is as follows:
function formSubmit(){
if(flag=="1"){
$("#form").submit();
}else if(flag=="2"){
$("#form").attr("action","deployResult.jsp");
$("#form").attr("target","_blank");

$("#form").attr("method","GET");
$("#form").attr("enctype","application/x-www-form-urlencoded");
$("#form").attr("encoding","application/x-www-form-urlencoded");
$("#form").submit();
}
}

I hope this article will be helpful to everyone’s web programming based on jQuery.

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