title: Disable button if conditions does not meet jQuery
body: <p>I have a condition that is if check box is checked and email field ends with @xyz.edu, then the submit button should be enabled and also, if checkbox is not checked and if email field is contains @xyz.edu, even then button should be disabled.</p>
  
  <pre><code>&lt;div class="input-field col s12 m10 offset-m1 offset-s2"&gt;
      &lt;input id="email" name="email" th:value="${user.email}" type="email" class="validate" /&gt;
      &lt;label for="email"&gt;Email&lt;/label&gt;
  &lt;/div&gt;
  
  &lt;div class="row"&gt;
      &lt;div class="input-field col s12 m10 offset-m1 offset-s2"&gt;
          &lt;input id = "checkbox" name="userRole" value="ADMIN" type="checkbox" class="validate" /&gt;
          &lt;label&gt;Admin&lt;/label&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="row"&gt;
      &lt;div class="input-field col s12 m10 offset-m1 offset-s2"&gt;
          &lt;button id="submit" class="btn waves-effect waves-light" type="submit" disabled = "disabled" name="action" value="signup"&gt;Sign Up&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>jQuery code:</p>
  
  <pre><code> $('#checkbox').click(function(){
  
             if(this.checked)
             {
                var email = $('#email').val();
                var str = "@sjsu.edu"
                if(email.match("@sjsu.edu$"))
                {
  
                  $("#submit").removeAttr("disabled");
                }
                else
                {
                  $("#submit").attr("disabled", "disabled");
                }
             }
      });
  </code></pre>
  
  <p>So when I give the input as @gmail.com and check the checkbox, button remains disabled. Now if I again change just the input field, it enables the button, even if condition is not met. Can someone help me</p>
  
  <p>Here's my link to code: <a href="https://jsfiddle.net/chandham/e5g0m7o9/" rel="nofollow noreferrer">https://jsfiddle.net/chandham/e5g0m7o9/</a></p>