I need some help with initializing a materialize component using JavaScript. My understanding of JS is lacking, but I have had success using jQuery. Specifically, I am looking to use the Collapsible component.
<ul class="collapsible">
<li>
<div class="collapsible-header"><i class="material-icons">filter_drama</i>First</div>
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
</li>
<li>
<div class="collapsible-header"><i class="material-icons">place</i>Second</div>
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
</li>
<li>
<div class="collapsible-header"><i class="material-icons">whatshot</i>Third</div>
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
</li>
</ul>
To initialize the collapsible:
// JS
var elem = document.querySelector('.collapsible');
var instance = new M.Collapsible(elem, options);
// Or with jQuery
$(document).ready(function(){
$('.collapsible').collapsible();
});