title: Hide element based on value of other elements
body: <p>I am trying to hide a table based on the value of two fields, so that if <code>field2</code> is equal to <code>field1</code> the table is hidden.</p>
  
  <p><a href="http://jsfiddle.net/3gh812x8/" rel="nofollow">JSfiddle</a></p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form&gt;
      Expected Number of Items: &lt;input type="text" value="14" name="totalItems" id="totalItems"&gt;
      &lt;p&gt;
      Number of Items Entered: &lt;input type="text" value="14" name="enteredItems" id="enteredItems"&gt;
  &lt;/form&gt; 
  &lt;p&gt;
  &lt;table border="1" style="width:100%" id="hideThis"&gt;
    &lt;tr&gt;
      &lt;td&gt;This should be hidden when "totalItems" equals "enteredItems"&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>function toggleClass(eid, myclass){
      var theEle = document.getElementById(eid);
      var eClass = theEle.className;
  
      if(eClass.indexOf(myclass) &gt;= 0){
          theEle.className = eClass.replace(myclass, "");
      }else{
          theEle.className  += "" +myclass;
      }
  }
  </code></pre>