title: C# MVC call javascript function on click
body: <p>How to we call a function from an external JS file on click?</p>
  
  <p>JS file on /Content/js/pj_no.js</p>
  
  <pre><code>function alertMe(){
      alert("me");
  }
  </code></pre>
  
  <p>C#</p>
  
  <pre><code>@Scripts.Render("~/Content/js/pj_no.js")
  &lt;input value="親コード新規登録" type="button" onclick="alertMe()" /&gt;
  </code></pre>
  
  <p>Assuming this is in the same file iin my csHTML it is working fine. But when I put it on the external JS it is not calling anymore. </p>
  
  <p>I know my JS is in the right directory as if i trigger an $(document).ready(function () {} it is calling the alert. But I need it to be on click event.</p>
  
  <p>Help please</p>
  
  <pre><code>$(document).ready(function (
  alert("me"); -- This is working,
  
  function alertMe(){ //cant call this function
      alert("me");
  }
  )});
  </code></pre>