Home > Web Front-end > JS Tutorial > How to use js to submit a form to easily solve the problem of multiple submit buttons on a page_javascript skills

How to use js to submit a form to easily solve the problem of multiple submit buttons on a page_javascript skills

WBOY
Release: 2016-05-16 17:14:41
Original
1227 people have browsed it
Copy code The code is as follows:

 function check(txt){ <br>$j("form").submit(function(){ <br>if($txt=="submit"){ <br>this.action="doAddMessage.action?button =Submit"; <br>this.submit(); <br>}else{ <br>this.action="doAddMessage.action?button=Save"; <br>this.submit(); <br>} <br>}); <br>}



 



For example: there are two image button submissions on the page. At this time, we You can bind onclick events to them all. At this time, we use the jquery form to have an event called submit.


As shown in the picture, since dwr is used in my project, I transferred the control of jquery to dwr, and jquery reassigned a $j. We get the form and then use submit Events can jump to multiple pages by judging the value of value.




Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template