title: jquery dynamic toggle button
body: <p>Using jQuery, I'm trying to make a quick &amp; dirty way of changing the innerHtml text of a control button (#ctrlBtn) to reflect the state of div's slideToggle()  using the html() method. I can't seem to get my head around it. It changes the button text on the 1st click but then that's it...
  here's the code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
        $(document).ready(function(){
          $("#StatsDetail").slideToggle(); //hide it to start
          $("button").click(function(){
            $("#StatsDetail").slideToggle(); //show/hide 
            // the next line is not working even w/standard if/else syntax...
            ($("#ctrlBtn").html!="Hide") ? $("#ctrlBtn").html("Hide") : "#ctrlBtn").html("View"); 
          }); //end-onClick
        }); //end-onLoad
  &lt;/script&gt;
  &lt;span class="right"&gt;&lt;button&gt;&lt;div id="ctrlBtn"&gt;View/Hide Details&lt;/div&gt;&lt;/button&gt;&lt;/span&gt;
  &lt;div id="StatsDetail"&gt; Lorem ipsum yadda yadda blah &lt;/div&gt;
  </code></pre>
  
  <p>ive even tried </p>
  
  <pre><code>if ($("#statsDetail").is(":visible")) {
      $("#ctrlBtn").html("Hide"); 
   } else { 
      $("#ctrlBtn").html("View");
  } 
  </code></pre>
  
  <p>I know I must be missing something really stupid. Any help would be appreciated.</p>
  
  <p>Joe Negron ~ NYC</p>