$(document).ready(function (){
var x = false;
$('#board_code').keyup(function(e) {
x = callFunc();
})
})
function callFunc(){
return expresion ? true : false;
}
JS global variable and function outside $(document).ready function
-
04-06-2022 - |
Вопрос
$(document).ready(function (){
var x = false;
$('#board_code').keyup(function(e) {
if(x)
callFunc();
})
})
function callFunc(){
if(expression==true)
x=true;
else
x=false;
}
I know i can just put the def of callFunc inside $(document).ready function, but what is the other way so that i wouldnt use global variable
UPDATE: i forgot to put the if(x), check it again. This is for brace matching in my web-based ide project ^^
Решение
Не связан с StackOverflow