applying a var to an if statement jquery
<p>Need to apply a var to a statement if its conditions are met, this syntax isn't throwing errors but its not working.</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){
  var action_is_post = false;
      //stuff here
    $(this).ready(function () {
        if ($("#stepDesc0").is(".current")) {
        action_is_post = true;     
        }
    });
  //stuff here
&lt;/script&gt;
</code></pre>

<p>should I use something other than <code>.ready</code>? Do I even need the <code>$(this).ready(function ()...</code> part? I need it to apply the <code>var</code> when <code>#stepDesc0</code> has the class <code>current</code>.</p>


$(document).ready(function(){
  var action_is_post = false;
  $("form").submit(function () {
    action_is_post = true;
  });

if ($("#stepDesc0").is(".current")) {
        var action_is_post = true;     
      }

 window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    if (!action_is_post)
      return 'Using the browsers back, refresh or close button will cause you to lose all form data. Please use the Next and Back buttons on the form.';
  }
});

