简体   繁体   English

通过转到上一页重新激活禁用的提交按钮

[英]Reactivate a disabled submit button by going to the previous page

Here is the js code I am using at the moment to disable a submit button :这是我目前用来禁用提交按钮的 js 代码:

$('form').submit(function(){
    $(':submit').html('submitting').addClass('disabled');
});

The problem is if the user goes back after submitting the form, the button will already be disabled.问题是如果用户在提交表单后返回,该按钮将已被禁用。 I tried a lot of "hacks" but the js doesn't seem to be reloaded by going back to the previous page (with the "previous" of the browser).我尝试了很多“黑客”,但通过返回上一页(使用浏览器的“上一页”)似乎没有重新加载 js。

Do you have an idea how to solve this problem?你知道如何解决这个问题吗?

Thanks !!谢谢 !!

对于那些有同样问题的人,这里是一种解决方案:

$(window).on('unload', function () {});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM