title: Uncaught TypeError: exit_modal is not a function at HTMLButtonElement.onclick
body: <p>I have recently converted my code into an <strong>asp.net format</strong> but am getting an this <strong>Uncaught TypeError</strong> with one of my <strong>JS functions</strong>. I have tested and it works when its not in the <strong>asp.net format.</strong> </p>
  
  <p>The error comes when i interact with a button that i supposed to close a message. I have double checked syntax but still cant find the error.</p>
  
  <p>This is the button - </p>
  
  <pre><code>&lt;div id="main_modal" class="modal"&gt;
      &lt;button type="button" value="Exit Modal" id="exit_modal" onclick="exit_modal()"&gt;X&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is the function it calls onclick - </p>
  
  <pre><code>function exit_modal(){
      document.getElementById("main_modal").style.visibility = "hidden";
  }
  </code></pre>
  
  <p>This is the error received in Chrome dev tools when button is clicked - </p>
  
  <blockquote>
    <p>Uncaught TypeError: exit_modal is not a function at HTMLButtonElement.onclick</p>
  </blockquote>
  
  <p>I am new to using asp.net so any help would be very appreciated. <strong>Thanks in advance.</strong>  </p>