我试图在页面上有一个模态表单,为此我使用 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 - jquery 对话框中的按钮不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40015932/