title: modal is not defined error
body: <p>jQuery Cide:</p>
  
  <pre><code>function modal(this) {
          alert($(this).data("id"));
      }
  </code></pre>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-id="&lt;?php echo $state['ID']?&gt;" onclick='modal(this)'&gt;Open Modal&lt;/button&gt;
  </code></pre>
  
  <p>Bootstrap Modal</p>
  
  <pre><code>&lt;!-- Modal --&gt;
  &lt;div id="myModal" class="modal fade" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
  
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;p&gt;Some text in the modal.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Uncaught ReferenceError: modal is not defined at HTMLButtonElement.onclick
  </code></pre>
  
  <p>I already defined modal outside of document ready function but it displaying me modal is not defined error How to resolve this error?</p>