gpt4 book ai didi

javascript - jquery 对话框中的按钮不显示

转载 作者:行者123 更新时间:2023-12-03 05:54:03 25 4
gpt4 key购买 nike

我试图在页面上有一个模态表单,为此我使用 jquery 对话框。但是,当表单出现时,对话框上的按钮不会出现。

这是创建对话框的 javascript:

   function showform() {
$("#formplan").dialog({
open: function(event, ui) {
$(".ui-dialog-titlebar-close").hide();
},
modal: true,
autoOpen: false,
dialogClass: "dialogform",
buttons: [{
text: "Planifier",
click: function() {
$("#formplan").dialog("close");
$("#formplan").submit();
}
}, {
text: "Cancel",
click: function() {
$("#formplan").dialog("close");
$("#formplan").dialog('destroy').remove();
}
}]
});
$("#formplan").dialog('open');
};

这是包含脚本调用的表单:

<div id="formplan" class="dijitDialog" role="dialog" style="display:none">
<form style="" action="javascript:refreshTab('tabadministrationplanificateurtaches', '/profusion/scheduler/etat.html?onglet=tabadministrationplanificateurtaches&mode=integre&planed=ImportPays ' + getfromform())">
<br>planification de la tache ImportPays :
<br>
<input type="radio" name="periodicity" value="1" checked> tout les jours
<br>
<input type="radio" name="periodicity" value="2"> par jours de la semaine :
<input type="checkbox" name="Daysofweek" value="1"> dimanche
<input type="checkbox" name="Daysofweek" value="2"> lundi
<input type="checkbox" name="Daysofweek" value="3"> mardi
<input type="checkbox" name="Daysofweek" value="4"> mercredi
<input type="checkbox" name="Daysofweek" value="5"> jeudi
<input type="checkbox" name="Daysofweek" value="6"> vendredi
<input type="checkbox" name="Daysofweek" value="7"> samedi
<br>
<input type="radio" name="periodicity" value="3"> par mois :
<input type="text" name="Daysofmonth" placeholder="ex : 1:3:21">
<br>effectuer à :
<input type="text" name="hours" placeholder="ex : HH:mm:ss/HH:mm:ss">
<br> </form>
</div>
<script>
showform();
</script>

此代码使用 JAVA 推送到 HTML,因此调用 showform() 的脚本仅在需要时才存在。另外,我注意到之前我仍然可以单击后面的页面,即使使用 modal:true ,如果我单击生成页面的按钮(在此过程中进行刷新),我的表单会出现两次。 我的猜测是它来自直接调用 showform() (没有链接到 onclick() 事件)。

谢谢

最佳答案

像这样在 javaScript 文件中调用 showform() 函数

 $( document ).ready(function() {
showform();
});

jsFiddle link

关于javascript - jquery 对话框中的按钮不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40015932/

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