title: How to use window.location.reload
body: <p>i am very new to jquery, so any advise and help will be much appreciated.</p>
  
  <blockquote>
    <p>The aim is: when a user refreshes a page the below jquery action
    should take place but i am unsure how to use window.location.reload in the code -
    any advise help would be much appreciated</p>
  </blockquote>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function () {
      $ window.location.reload(true);
          $(".message-content" ).removeClass( "hide" )
          $(".unlimited-content" ).addClass( "hide" )
          $(".basic-content" ).addClass( "hide" )
          $("#paypal_express_checkout input:first").val("10165346");
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <blockquote>
    <p>i decided to try the below, it partially works as it displays the
    jquery action but then it does an automatics refresh which does not
    display the result of the jquery code to be excuted</p>
  </blockquote>
  
  <pre><code>&lt;script&gt;
      $(window).on('beforeunload', function(){
          $(".message-content" ).removeClass( "hide" )
          $(".unlimited-content" ).addClass( "hide" )
          $(".basic-content" ).addClass( "hide" )
          $("#paypal_express_checkout input:first").val("10165346");
      });
  &lt;/script&gt;
  </code></pre>