title: How to know the form is submitted on page load?
body: <p>I have a form and I want to set focus on the status message when the form is submitted.</p>
  
  <p>I have tried the following code.</p>
  
  <pre><code>$('form').on('submit', function(){
    $('.messages--status').focus();
  });
  </code></pre>
  
  <p>But the problem is that when I submit the form the page reloads and therefore my code is not working.</p>
  
  <p>Is there any way to find on page reload that the form is submitted?</p>
  
  <p>So that can I set the focus on the status message based on that condition?</p>