gpt4 book ai didi

单击按钮时的 jquery 对话框

转载 作者:行者123 更新时间:2023-12-03 22:58:47 27 4
gpt4 key购买 nike

我试图让 jquery 对话框在单击按钮时启动,但似乎不起作用。任何帮助将不胜感激:

    $('#wrapper').dialog({
autoOpen: false,
title: 'Basic Dialog'
});
$('#opener').click(function() {
$(this).dialog('open');
return false;
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script>
<button id="opener">Open the dialog</button>
<div id="wrapper">
<p>Some txt goes here</p>
</div>

谢谢!

最佳答案

这一行

$(this).dialog('open');  // this here corresponds to the #opener div

应该是

$('#wrapper').dialog('open');

还有额外的大括号 }); .. 如果这是 DOM Ready handler 的右大括号,则可以忽略

<强> Check Fiddle

关于单击按钮时的 jquery 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13592408/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com