I'm trying to return a value from a Zebra_Dialog framework. I need a value like true or false in order to send it as an input so I can update my store card.
The problem is that I'm able to do it with confirm (which return always a value like true or false, but I've no idea about how to do with a javascript framework with that structure.
My code so far was the following:
confirm():
$('#removebuttonstyle i').click(function() {
console.log("you click!");
var c = confirm("Are you sure that you want to continue?");
return c;
});
zebra():
$('#removebuttonstyle i').on('click', function(e) {
console.log("you click!");
e.preventDefault();
var t = $.Zebra_Dialog('<strong>Zebra_Dialog</strong>, a small, compact and highly configurable dialog box plugin for jQuery', {
type: 'question',
title: 'Custom buttons',
buttons: ['Yes', 'No'],
onClose: function(buttons) {
if (buttons=='Yes') {
return true;
} else {
return false;
}
}
});
return buttons;
});
Like you can imagine, the zebra approach doesn't work. Any help? Someone who did that?
Update: I actually made some progress, so the last step is to reassign the value to true or false:
$('#removebuttonstyle i').on('click', function(e) {
console.log("you click!");
e.preventDefault();
var t = $.Zebra_Dialog('<strong>Zebra_Dialog</strong>, a small, compact and highly configurable dialog box plugin for jQuery', {
type: 'question',
title: 'Custom buttons',
buttons: [
{caption: 'Yes'},
{caption: 'No'}
],
onClose: function(caption) {
caption == 'Yes' ? true : false;
console.log(caption);
}
});
});
If I console.log caption I still obtain yes or not, but I need to reassign the value true or false to the variable.