javascript - 选择值后显示消息框

标签 javascript jquery ajax dialog messagebox

我想在某个文本字段选择ajax自动完成值时显示一个消息框。我正在使用jquery-confirm为此使用 js 库。这是我的代码。

                    select: function( event, ui ) {
                        console.log( ui.item.value );
                        nic= ui.item.value;
                        $("#msgbox").open();
                        return false;
                    }

.

    $("#msgbox").confirm({
        title: 'Entry Found',
        content: 'msg',
        lazyOpen:true,
        buttons: {
            confirm: function () {
                $.alert('Confirmed!');
            },
            cancel: function () {
                $.alert('Canceled!');
            },

ps:我对 js 和这些 jquery 东西很陌生。:)

最佳答案

试试这个。使用“dialog”代替“confirm”。在“select”中像这样调用。

$("#msgbox").dialog("open");

还有

$("#msgbox").dialog({
    title: 'Entry Found',
    content: 'msg',
    autoOpen: false,
    modal: true,
    lazyOpen:true,
    buttons: {
        confirm: function () {
            alert('Confirmed!');},
        cancel: function () {
            alert('Canceled!');}
}
});

关于javascript - 选择值后显示消息框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47802243/

相关文章:

javascript - 如何查看某个键是否包含值并将该键返回 2 级?亚历克斯/JS

javascript - 使用 .innerHTML 创建 div 元素会产生意外结果

jquery - 跨域ajax的问题

javascript - XML .attributes 不起作用

javascript - 找不到节点错误 - 尽管可以在控制台中找到节点

javascript - 如何使用单选按钮更改表单?

javascript - 在 React Component 中返回结束标签和开始标签?

javascript - 计算每个元素的百分比

jquery - phantomjs/selenium 和 jQuery 自动填充表单的方式有区别吗?

javascript - AngularJS promise 在加载数据之前被解决