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.
<script>
function SleepTime(value) {
$(document).ready(function () {
$("#ajaxSubmit").click(function (){
setTimeout(function() {
$('#progressBarCenter').modal('toggle');
}, value);
});
});
}
</script>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#progressBarCenter" id="ajaxSubmit" onclick="SleepTime(2000);" > Execute Script</button>
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??
tks