title: changing the css class of an element after manipulating its styles through javascript doesn't work
body: <p>html:</p>
  
  <pre><code>&lt;input id="myinput" class="cinput" type="image" src="http://www.foodwater.org.au/images/triple-spiral-3-small-button.jpg"/&gt;
  &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;button id="s"&gt;set to visible class&lt;/button&gt;
  &lt;button id="h"&gt;set to hidden class&lt;/button&gt;
  &lt;button id="db"&gt;set display:block&lt;/button&gt;
  &lt;button id="dn"&gt;set display:none&lt;/button&gt;
  </code></pre>
  
  <p>javascript:</p>
  
  <pre><code>$("#s").on("click", show);
  $("#h").on("click", hide);
  $("#db").on("click", db);
  $("#dn").on("click", dn);
  
  function show() {
      document.getElementById("myinput").className = "cinputvis";
  }
  
  function hide() {
      document.getElementById("myinput").className = "cinput";
  }
  
  function db() {
      document.getElementById("myinput").style.display = "block";
  }
  
  function dn() {
      document.getElementById("myinput").style.display = "none";
  }
  </code></pre>
  
  <p>css:</p>
  
  <pre><code>.cinput {
      position: absolute;
      display: none;
      top: 0px;
      left 0px;
      margin: 0px;
      border: 1px solid black;
      cursor: pointer;
  }
  
  .cinputvis {
      position: absolute;
      display: block;
      top: 0px;
      left 0px;
      margin: 0px;
      border: 1px solid black;
      cursor: pointer;
  }
  </code></pre>
  
  <p>So, If let's say i use the two buttons which change the element's class, I can toggle the button on and off, but once i use the other buttons to to manipulate the <strong>display</strong> property directly, I can't use any more the changing of className buttons to toggle them.</p>
  
  <p>So I was wondering why is this happening ? Shouldn't changing the classname clear up everything and reassign the css directives ?</p>
  
  <p><a href="http://jsfiddle.net/5v8ub/6/" rel="nofollow">http://jsfiddle.net/5v8ub/6/</a></p>