title: Dojo Toggle Hide and Show Divs
body: <p>I've done some searching and come up with a lot of mixed results for using Dojo to toggle divs showing vs hidden.</p>
  
  <ul>
  <li>Some use <code>dojo.style</code> which it looks like might have been replaced by <code>dojo.fx</code></li>
  <li>Some use <code>dijit</code> but thus cannot access a DOM node.</li>
  <li>Some make use of <code>show()</code> and <code>hide()</code></li>
  <li>Some change the CSS</li>
  </ul>
  
  <p>I can't seem to get any of them to work.</p>
  
  <p>Can someone please point me towards an up-to-date walkthru on this.</p>
  
  <hr>
  
  <p><strong>Solved</strong></p>
  
  <p>Used a combination of the following...</p>
  
  <pre><code>dojo.addOnLoad(function() {
        dojo.style(dojo.byId('myDiv'), "display", "none");
  });
  </code></pre>
  
  <p>and to toggle it</p>
  
  <pre><code>function toggleDivs(){
      if(   dojo.style(dojo.byId('myDiv'), "display") == "none"){
          dojo.style(dojo.byId('myDiv'), "display", "block");
          dojo.style(dojo.byId('myDiv2'), "display", "none");
      } else {
          dojo.style(dojo.byId('myDiv'), "display", "none");
          dojo.style(dojo.byId('myDiv2'), "display", "block");
      }
  }
  </code></pre>