简体   繁体   English

jQuery UI对话框按钮不会隐藏

[英]jQuery UI Dialog Buttons won't hide

Somehow this code doesn't work properly. 此代码某种程度上无法正常工作。 All Buttons are shown, only the "Generate" Button hides after the sucessful link generation. 显示所有按钮,成功生成链接后仅隐藏“生成”按钮。 On the same site I have another dialog, implement the same way, which is working fine. 在同一站点上,我还有另一个对话框,以相同的方式实现,效果很好。

 $("#guest-link-dialog").dialog({ autoOpen: false, resizable: false, height: 300, width: 510, modal: true, draggable: false, closeOnEscape: false, open: function() { $("#closeButton").hide(); }, buttons: [{ id: 'generateButton', text: 'Generieren', click: function() { $('#generatedlink').html('<img src="<?php echo Yii::app()->request->baseUrl; ?>/images/icons/32x32/loading.gif" alt="loading" style="padding-left:215px;padding-top:40px;" />'); $.getJSON('<?php echo Yii::app()->request->baseUrl; ?>/index.php?r=ajax/guestlink&fileid=' + $(this).data('fileid') + '&count=' + $('#inputcount').val()) .done(function(json) { if (json.status == "SUCESS") { $('#generatedlink').html('<a href="' + json.url + '" >' + json.url + '</a>'); $('#generateButton').hide(); $('#cancelButton').hide(); $('#closeButton').show(); } else if (json.status == "ERROR") { $("#message").css('color', 'red'); } $("#message").text(json.message); }) .fail(function(json) { $("#message").css('color', 'red'); $("#message").text('Fehler'); }); } }, { id: 'closeButton', text: 'Schliessen', click: function() { $(this).dialog('close'); } }, { id: 'cancelButton', text: 'Abbrechen', click: function() { $(this).dialog("close"); } }], close: function() { $("#message").css('color', ''); $('#generatedlink').html(''); $('#generateButton').show(); $('#cancelButton').show(); $('#closeButton').hide(); } }); 

Edit: 编辑:

 <div id="guest-link-dialog" title="Gast Link erstellen"> <form> <fieldset style="border:1;"> <label for="count">Anzahl m&ouml;gliche Downloads</label> <input type="text" name="count" id="inputcount" class="text ui-widget-content ui-corner-all" size="1" value="1" maxlength="1" /> </fieldset> </form> <div id="generatedlink" style="width:100%"></div> </div> 

The problem was, the Button IDs were already used by the other Dialog. 问题是,另一个对话框已经使用了按钮ID。 Giving them other IDs solves the problem. 为他们提供其他ID可解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM