Blogger Information
Blog 175
fans 1
comment 0
visits 384818
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
防止form表单提交按钮多次点击导致提交多次
dxp2tq的博客
Original
1663 people have browsed it

防止form表单提交按钮多次点击导致提交多次


在form元素上添加onsubmit监听事件:

<form action="$!webPath/buyer/address_save.htm" method="post" id="theForm" onsubmit="disabledSubmit(this)">

点击提交按钮之后,验证表单是否合法:

function disabledSubmit(form){

if(jQuery(form).valid()){

jQuery("#submitBtn").attr("disabled", "disabled");

}

return true;

}

如果合法,将提交按钮设置为失效,这样表单只会被提交一次。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post