【问题标题】:Can't open the custom dialog box using jquery无法使用 jquery 打开自定义对话框
【发布时间】:2019-03-23 05:17:50
【问题描述】:

我正在尝试使用 jQuery Core 创建自定义对话框。

<button id="finish" value="Finish">Finish</button>
<dialog id="confirm-finish">
    <p>Confirm to end test</p>
    <span>
        <button value="y">Yes</button>
        <button value="n">No</button>
    </span>
</dialog>
$("#finish").click(function(){
    $("confirm-finish").dialog('open');
});

dialog() 和 modal() 函数在这里都不起作用

我期待一些可以使用核心 jquery 打开对话框的功能

【问题讨论】:

    标签: javascript jquery dialog modal-dialog


    【解决方案1】:

    打开对话框没有内置函数。

    您需要添加打开属性显示对话框

    $("#confirm-finish").attr('open','');
    

    要再次隐藏它,您必须调用

    $("#confirm-finish").removeAttr('open');
    

    Modal 是不同的东西,你需要为它使用引导库,最好使用 modal,因为它提供了更好的选项来管理更好的 UI。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-07-25
      • 1970-01-01
      • 2014-07-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多