title: Materialize:How to programmatically open and close collapsibles
body: <p>Trying to execute the open() method of on a specific collapsible element in  <strong>Materialize</strong> inside DOM using the following function:</p>
  
  <pre><code>document.addEventListener('DOMContentLoaded', function () {
          var elems = document.querySelectorAll('.collapsible');
          var options = {};
          var instances = M.Collapsible.init(elems);
          console.log(instances);
          instances.open(1);    
      });
  </code></pre>
  
  <p>And getting the following error:</p>
  
  <pre><code>Uncaught TypeError: instances.open is not a function
      at HTMLDocument.&lt;anonymous&gt; 
  </code></pre>