How can I execute this function only one time? I tried bind or unbind but it doesn’t work
JavaScript
x
<uib-tab-heading onclick="myFunction()"><i class="fa fa-keyboard-o"></i> Typing Test </uib-tab-heading>
JavaScript
function myFunction() {
alert("hit");
}
Advertisement
Answer
Try this below :
JavaScript
Use this flag in your $document.ready scope (global scope)
var flag = false
if(!flag){
function myFunction() {
flag = true;
alert("hit");
}
}