Comments (7)
This will sound silly, but I have never needed a vairable like this :)
But this is done simply by having a variable outside your function, like below.
var my_value;
$('#removebuttonstyle i').on('click', function(e) {
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) {
my_value = (caption == 'Yes');
}
});
});
But I don't think you need a variable but rather you need to alter something in DOM, based on the selection in the dialog. If so, the DOM manipulation has to be done in the onClose
function
from zebra_dialog.
I kind of solve my problem with a snippet like that:
$('#removebuttonstyle i').on('click', function(e) {
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) {
if (caption == 'Yes') {
$("#removebuttonstyle i").unbind('click').click()
} else {
caption = false;
}
return caption;
}
});
});
What do you think about it?
from zebra_dialog.
I first need to know what are you trying to achieve. Are you trying to prevent the dialog from opening again if the user clicked on "Yes" ?
from zebra_dialog.
I'm working in an expressionengine environment with a store plugin on top (espresso). This actually worked but there is a lot of code involved on top of that. As I told you in my first email, I was trying to emulate the confirm javascript function.
This is how my code looks like:
<td class="col-md-1 text-right">
<button type="submit" id="removebuttonstyle" name="remove_items[{key}]" value="remove">
<i class="fa fa-minus-circle"></i>
</button>
</td>
If I use the confirmation method like that:
// $('#removebuttonstyle i').click(function() {
// console.log("you click!");
// var c = confirm("Are you sure that you want to continue?");
// return c;
// });
It's gonna work the same way it works now with Zebra..
from zebra_dialog.
$('#removebuttonstyle i').on('click', function(e) {
e.preventDefault();
$.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', callback: function() {
$('your-form').submit();
}},
{caption: 'No'}
]
});
});
from zebra_dialog.
I'm not sure if that is working, though...
from zebra_dialog.
Don't worry, mine works! I will try both
from zebra_dialog.
Related Issues (20)
- How close modal in parent window from inside an iframe? HOT 2
- Zebra Dialog with Microsoft Edge HOT 8
- Add version number as public variable
- Focus lost on Android device HOT 2
- Add custom css on buttons
- IE8 compatibility broken
- Can I modify the dialog text? HOT 1
- Buttons are displayed in reverse order HOT 1
- Lose of Focus HOT 3
- center_buttons property not centering buttons in latest build HOT 3
- Change Request: Setting default type as false instead of info HOT 1
- if onSave callbacks returns false buttons are permanently disabled HOT 2
- Add option to make dialog draggable HOT 1
- Provide a way to know when a dialog is opening
- button support setting background color HOT 1
- Zebra Dialog won't dismiss... HOT 8
- Lost focus after close dialog. HOT 2
- Responsive HOT 16
- No iFrame Scrollbars on iPhones / Touch devices HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zebra_dialog.