I fear I may be losing my marbles today, because I don't know how to do what I want to. I want a custom prompt that I can call from any of my other JavaScript functions. I don't know how to get this work, even though it feels like I've done it a hundred times.
Here is an example
var modal = function() {
var prompt = function(msg) {
// custom prompt builder here... let's return hard coded for example's sake
return true;
};
}();
var items = function() {
var init = function() {
$('.delete').click(function() {
var confirm = modal.prompt('Are you sure you wanna delete that pal?');
});
};
$(document).ready(init);
}();
What I want to be able to do is call the prompt method of modal, and get a return value based on the user input. Now this, I can do, but I am having problems calling the inner method. I want to group these together because I will probably have a custom modal alert()
too.
Please don't suggest the built in JavaScript OK/Cancel as I gotta do this custom.
Many thanks!