Materialize modal not working : <p>I wrote a simple code for materialize modal.<br>
<strong>HTML code:</strong>  </p>

<pre><code>&lt;a class="waves-effect waves-light btn view" data-target="modal1"&gt;View Scores&lt;/a&gt;
&lt;!-- Modal Structure --&gt;
&lt;div id="modal1" class="modal"&gt;
  &lt;div class="modal-content"&gt;
    &lt;h4&gt;Modal Header&lt;/h4&gt;
    &lt;p&gt;A bunch of text&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
    &lt;a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"&gt;Agree&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;  
</code></pre>

<p><strong>JS code:</strong>  </p>

<pre><code>$(document).ready(function() {
  // the "href" attribute of .modal-trigger must specify the modal ID that wants to be triggered
  /*$('.view').click(function (){
    $('#modal1').modal('open'); 
    alert('edskjcxnm');
  });*/
  /*$('.view').leanModal();*/
  $('#modal1').modal('open');
});  
</code></pre>

<p>JSFiddle link: <a href="https://jsfiddle.net/7f6hmgcf/" rel="noreferrer">https://jsfiddle.net/7f6hmgcf/</a><br>
Why isn't it working?</p>
