0

This seems simple enough but can't determine what event should I look in to.

Sample code:

let forms = document.getElementsByTagName('form');
forms[0].addEventListener('submit', () => {
  document.getElementById('submit').disabled = true;
});
<form action="submit.html" method="post">
  <input type="submit" id="submit" value="Submit" />
</form>

The code above will disable the submit button upon submit. How do you enable it again when you hit the browser back button?

Daweed
  • 1,419
  • 1
  • 9
  • 24
IMB
  • 15,163
  • 19
  • 82
  • 140
  • I think this one answers your Question: https://stackoverflow.com/questions/25806608/how-to-detect-browser-back-button-event-cross-browser – CodingTony Feb 19 '21 at 11:50
  • 1
    Does this answer your question? [How to detect if the user clicked the "back" button](https://stackoverflow.com/questions/2008806/how-to-detect-if-the-user-clicked-the-back-button) – Irfan wani Feb 19 '21 at 11:52

0 Answers0