JQuery对话框删除状态图像
我在jQuery对话框中有密码表单。一旦表单提交,我需要删除该图像,但这似乎不起作用。有人能告诉我怎么做吗 这是dialog的HTML:JQuery对话框删除状态图像,jquery,jquery-ui,jquery-ui-dialog,Jquery,Jquery Ui,Jquery Ui Dialog,我在jQuery对话框中有密码表单。一旦表单提交,我需要删除该图像,但这似乎不起作用。有人能告诉我怎么做吗 这是dialog的HTML: <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"> <div class="ui-dialog-buttonset"> <button class="ui-button ui-widget ui-state-default ui-corne
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Retrieve it</span>
</button>
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
</button>
</div>
<img id="password-status" class="progressStatus" title="Status" alt="Status" src="/Content/alert/progress.gif" style="">
</div>
另一次尝试:
$(".ui-dialog-buttonpane").remove($("#password-status").fadeOut());
如果您实际正在使用,页面将被刷新,这样您就不必删除它。使用表单提交查看页面时,不要添加服务器端代码。您将在PHP或ASP代码(或您正在使用的任何服务器端技术)中实现这一点
如果您使用的是AJAX而不是HTML表单,请尝试向每个按钮添加id
,并通过jQuery绑定click事件
给你
修改您的HTML以添加那些id
s:
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button id="retrieve-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Retrieve it</span>
</button>
<button id="cancel-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
</button>
</div>
<img id="password-status" class="progressStatus" title="Status" alt="Status"
src="/Content/alert/progress.gif">
</div>
你真的要删除它还是隐藏它?如果只是想隐藏,请执行$('yourID').toggle();它会产生一种淡出效果。@ricardordz,你的解决方案很好。谢谢
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button id="retrieve-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only ui-state-hover" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Retrieve it</span>
</button>
<button id="cancel-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button" role="button" aria-disabled="false">
<span class="ui-button-text">Cancel</span>
</button>
</div>
<img id="password-status" class="progressStatus" title="Status" alt="Status"
src="/Content/alert/progress.gif">
</div>
$("#retrieve-button").click(function() {
// Todo: Add submit https AJAX call here, and bind success to removeImages.
// For now, we'll just call it directly
removeImages();
});
function removeImages() {
$("#password-status").remove().fadeOut();
}