提交后禁用 JQuery
我很抱歉问了一个似乎有大量信息的问题,但我似乎没有得到任何结果。
我只是想阻止双重表单提交的发生,我使用以下代码:
<script language="javascript" src="/js/jquery-1.6.1.min.js"></script>
<script language="javascript">
$(document).ready(function(){
$("#cc_form").submit(function() {
if ($.data($("#cc_form").get(0), 'submitting')) {
return false;
}
$.data($("#cc_form").get(0), 'submitting', true);
$(".submit",$("#cc_form")).prop('disabled', true);
});
});
</script>
它在 FF 4 和 FF 5 中工作正常,在 IE 8 或 IE 9 中不起作用。在 IE 中,我得到“对象” document.ready 行上的预期”。我尝试将其从头部移动到关闭主体之前,我尝试使用 type=text/javascript
和 language=javascript
,我尝试使用 jQuery(function()..
而不是 document.ready
并且无论我尝试什么,我都会在 IE 中收到该错误,并且它不会停止多个表单提交(而 FF 继续工作) 错误)。
没有任何
I'm sorry for asking a question that there seems to be TONS of info on, but I don't seem to be getting anywhere.
I'm simply trying to stop a double form submission from happening, I'm using the following code:
<script language="javascript" src="/js/jquery-1.6.1.min.js"></script>
<script language="javascript">
$(document).ready(function(){
$("#cc_form").submit(function() {
if ($.data($("#cc_form").get(0), 'submitting')) {
return false;
}
$.data($("#cc_form").get(0), 'submitting', true);
$(".submit",$("#cc_form")).prop('disabled', true);
});
});
</script>
It works fine in FF 4 and FF 5, it does not work in IE 8 or IE 9. In IE I get that "Object Expected" on the document.ready line. I've tried moving it from the head to just before the closing body, I tried using type=text/javascript
and language=javascript
, I've tried using jQuery(function()..
instead of document.ready
and no matter what I tried I get that error in IE and it does not stop multiple form submissions (while FF continues to work without any error).
Any Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我突然想到一件事:
试一试:
One thing jumps out at me:
Give this a shot:
我已经准备好了——我不知道该说什么。只是为了尝试一些不同的东西,我下载了未压缩的版本,它成功了!然后我再次下载分钟,即使它们与文件系统上的字节相同,它仍然有效!
I'm all set - I don't know what to say. Just to try something different I downloaded the uncompressed version and it WORKED!. I then download the min again and even though they are the same to the byte on the filesystem, it worked!