title: Call Javascript function within Bootstrap button
body: <p>I have a javascript code which I would like to put it in a function called SleepTime so I can pass in value and then call this function when I click on a button in an html page.  Here's my code.</p>
  
  <pre><code>&lt;script&gt;
      function SleepTime(value) {
          $(document).ready(function () {
              $("#ajaxSubmit").click(function (){
                  setTimeout(function() {
                      $('#progressBarCenter').modal('toggle');
                  }, value);
              });
          });
      }
  &lt;/script&gt;
  
  &lt;button type="button" class="btn btn-primary" data-toggle="modal" data-target="#progressBarCenter" id="ajaxSubmit" onclick="SleepTime(2000);" &gt; Execute Script&lt;/button&gt;
  </code></pre>
  
  <p>I get an error when I ran the above code.  It said the function is undefined but I did define it?? How do I call this function so I can pass in the value??  </p>
  
  <p>tks</p>