title: Adding on click events to buttons in MVC Razor
body: <p>I've been trying to call a javascript function from a button click, and I can't figure out what I'm doing wrong. </p>
  
  <p>I've searched for similar questions and followed the answers, but the button click is still not calling the function.</p>
  
  <p>The following code is in my <code>.cshtml</code> page. First, I create the button  </p>
  
  <pre><code>&lt;input type="button" id="myButton" onclick="Save()"/&gt;  
  </code></pre>
  
  <p>And I have a function on the same page  </p>
  
  <pre><code>&lt;script&gt; function Save() { ..do stuff here } &lt;/script&gt;
  </code></pre>
  
  <p>This function never gets called. What am I doing wrong?</p>