Hello all!
To the point, I want to override the standard js confirm() function within a jQuery plugin. I have figured out how to do it with the simple function layout below.
function confirm(opts) {
//code
}
Now, what I want to do is call another function within the confirm function above, like so...
function confirm(opts) {
openModal(opts);
}
The openModal function will open a custom modal window with the message and required buttons. The buttons are both <span> with the id of either submit or cancel. submit returns true and cancel returns false. But now, how do I return either true or false based on the button clicked?
For example...
$('#openModal').live('click', function() {
var opts = { title:'Modal Title', message:'This is a modal!' };
var resp = confirm(opts);
if(resp)
// user clicked <span id="submit"></span>
else
// user clicked <span id="cancel"></span>
});
Hopefully you understand what I mean.