I have a submit button in my login page. I want to disable the submit button after clicking once.I'ts working fine with this.disabled = true;
query and after disable the button it's going to the next page. The problem is that when I press back button it's still is disable because the page is not reloaded from server,It's loading from the local cache. I want to enable the button every time when I come back to the login page. I can clear the cache but there is some problem like if it will load from the server and project will be slow. What will be the best way to do this?
<script>
$(document).ready(function(){
$(document).on('click','button',function(){
this.disabled = true
window.location="https://www.google.co.in/"
})
})
</script>
<body>
<button type="submit" id="button">Click Me!</button>
</body>
I set the buttons initial disabled attribute to disabled in the body html to prove that the code does enable it again (so you can remove that in the body) I hope this helps:
<script>
$(document).ready(function () {
$("#button").removeAttr('disabled');
$("#button").click(function(){
$(this).attr('disabled','disabled');
window.location="https://www.google.co.in/"
});
});
</script>
<body>
<button type="submit" id="button" disabled="disabled">Click Me!</button>
</body>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With