无法使用 jquery 打开自定义对话框

Can't open the custom dialog box using jquery

我正在尝试使用 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

打开对话框没有内置功能。

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

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

要再次隐藏它你必须调用

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

模态是不同的东西,你需要为它使用 bootstrap 库,最好使用模态,因为它提供了更好的选项来更好地管理 UI。