remove disable if if statement true in javascript
<p>I can't put together a javascript <code>if statment to activate my submit button     if(username_ready &amp;&amp; email_ready)  ("#register").removeAttr("disabled");</code> so I have two vars and if they are both true I want the submit button to be active. The above doesn't seem to work? I tried to hitch it into this...</p>

<pre><code>$(document).ready(function()
{
$("#username").blur(function()
{
    //remove all the class add the messagebox classes and start fading
    $("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn(1000);
    //check the username exists or not from ajax
    $.post("user_availability.php",{ username:$(this).val() } ,function(data)
    {
      if(data=='no') //if username not avaiable
      {
        $("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
        { 
          //add message and change the class of the box and start fading
          $(this).html('This User name Already exists').addClass('messageboxerror').fadeTo(900,1);
         var username_ready = false;
        });     
      }
      else
      {
        $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
        { 
          //add message and change the class of the box and start fading
          $(this).html('Username available to register').addClass('messageboxok').fadeTo(900,1);
           var username_ready = true;   
        });
      }

    });

});
});
&lt;/script&gt;

&lt;script src="jquery.js" type="text/javascript" language="javascript"&gt;&lt;/script&gt; 
&lt;script language="javascript"&gt; 

$(document).ready(function()
{
$("#email").blur(function()
{
    //remove all the class add the messagebox classes and start fading
    $("#box").removeClass().addClass('messagebox').text('Checking...').fadeIn(1000);
    //check the username exists or not from ajax
    $.post("email_availability.php",{ email:$(this).val() } ,function(data)
    {
      if(data=='no') //if username not avaiable
      {
        $("#box").fadeTo(200,0.1,function() //start fading the messagebox
        { 
          //add message and change the class of the box and start fading
          $(this).html('This email name Already exists have you forgot your password? ').addClass('messageboxerror').fadeTo(900,1);
         var email_ready = false;
        });     
      }
      else
      {
        $("#box").fadeTo(200,0.1,function()  //start fading the messagebox
        { 
          //add message and change the class of the box and start fading
          $(this).html('Tezac Hamra').addClass('messageboxok').fadeTo(900,1);
           var email_ready = true;  
        });
      }

    });

});
});
</code></pre>

<p></p>
