논리 값으로 돌아가, 내가 함수로 확인 방법을 포장 그래서 그것을마다 시간 https://jsfiddle.net/8g0j4unj/의 jQuery confirm.js이 결과는 내가이 <a href="https://craftpip.github.io/jquery-confirm/#confirm" rel="nofollow noreferrer">plugin</a>을 사용하고
function askQuestion($msg){
$.confirm({
icon : 'fa fa-question-circle-o',
content : ''+$msg+'',
theme : 'supervan',
closeIcon: true,
animation: 'scale',
type: 'orange',
draggable:'true',
buttons:{
'Continue' : {
keys : ['enter'],
action : function(){
return 1;
}
},
'Cancel': {
keys : ['esc'],
action: function(){
this.close();
}
}
}
});
}
을 사용할 수 있습니다 어떤 행동을하지만 프로세스를 계속하는 경우, 사용자가 조건을 확인하거나 취소 할 때 어떻게 함수를 부울로 반환 할 수 있습니까? 이 동안이 플러그인을 수행 할 callback
기능을 가지고 쉽게 사용할 수있는 이유
$(document).on('click','.sample',function(){
if(askQuestion('Are you sure want to continue without adding a server') == 1){
alert('Confirmed');
}
else{
alert('Cancelled');
}
});
으로 간단하게 검색 할 수 있습니다. – Titus
"return true"또는 "false false"에 대해 어떻게 생각하십니까? –
@ sachinkumar 나는 벌써 작동하지 않았다. –