title: Does something like jQuery.toggle(boolean) exist?
body: <p>I write something similar to the following code a lot. It basically toggles an element based on some condition.</p>
  
  <p>In the following made-up example, the condition is "If the <code>agree</code> checkbox is checked and the <code>name</code> field isn't empty".</p>
  
  <pre><code>$("button").click(function() {
    if ($("#agree").is(":checked") &amp;&amp; $("#name").val() != "" ) {
      $("#mydiv").show();
    } else {
      $("#mydiv").hide();
    }
  });
  </code></pre>
  
  <p>I wish there was some sort of jQuery function that would work like this.</p>
  
  <pre><code>$("button").click(function() {
    var condition = $("#agree").is(":checked") &amp;&amp; $("#name").val() != "" );
    $("#mydiv").toggle(condition);
  });
  </code></pre>
  
  <p>Is there something like this out there?  Or are there other ways besides the first example to do this in a less <code>if-else-ish</code> way?</p>