我今天可能有点糊涂了,因为我不知道如何做我想要的事情。我想要一个自定义提示框,可以从我的其他JavaScript函数中调用它。尽管我觉得我已经做了一百次,但我还是不知道如何使其工作。
下面是一个例子:
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);
}();
我想要做的是调用模态框的提示方法,并根据用户输入获得返回值。这个我能做到,但我在调用内部方法时遇到了问题。我想把它们分组在一起,因为我可能也会有一个自定义的
alert()
模态框。请不要建议使用内置的JavaScript OK/Cancel,因为我必须自定义。
非常感谢!
()
并误解您的意图。 - outis