code show as below:
function tips(){
//调用函数时,显示弹出层
$('.mask').show();
//取消
$('.cancel').on('click',function(){
$('.mask').hide(); //隐藏弹出层
return false;
});
//确定
$('.confirm').on('click',function(){
$('.mask').hide(); //隐藏弹出层
return true;
});
}
I want to call it like this:
if( tips() ){
do_something_true...
}else{
do_something_false...
}
If you want to show off your skills, you can do it in ES7:
Add a flag. Flag can also be represented by numbers like 0 and 1.
I just learned a very stupid method
var tips_vla="";
function tips(){
}
tips();
function al(){
if(tips_vla){
}else{
}
}
The laziest way is to add an exclamation mark, hee hee hee
Of course, it is best to write a sentence in the tips() function, return true