如何通过ulr load删除jQuery UI对话框中的内容?(How to remove content on the jQuery UI dialog via ulr load?)

编程入门 行业动态 更新时间:2024-10-27 21:18:15
如何通过ulr load删除jQuery UI对话框中的内容?(How to remove content on the jQuery UI dialog via ulr load?)

我已经让它工作,但问题是当我删除内容时,主页面内容也被删除,因为具有相同的类名。 如何只控制模态内容并删除某些类而不从父页面中删除它们。

var $modalDialog = $('<div/>', { 'class': 'exampleModal', 'id': 'exampleModal1' }) .appendTo('body') .dialog({ resizable: true, title:'Approval', autoOpen: false, width:'auto', height:'auto', show: 'fold', position: { my: "right top", at: "top" }, modal: true, close: function(event, ui) { location.reload(); } }).css("overflow", "auto"); $(function () { $('a.exampleLink').on('click', function (e) { e.preventDefault(); // TODO: Undo comments, below var url = $(this).attr('href'); $modalDialog.load(url, function(){ $( ".ewMenu" ).hide(); $( ".ewHeaderRow" ).hide(); $('h4').hide(); $( "#btnCancel" ).hide(); $( ".ewToolbar" ).hide(); $( ".ewFooterRow" ).hide(); }); $modalDialog.dialog("open"); }); });

i already got it to work but the problem is when i remove the content the main page content is removed as well because have the same class name. how can i control only the modal content and remove certain classes without removing them from the parent page.

var $modalDialog = $('<div/>', { 'class': 'exampleModal', 'id': 'exampleModal1' }) .appendTo('body') .dialog({ resizable: true, title:'Approval', autoOpen: false, width:'auto', height:'auto', show: 'fold', position: { my: "right top", at: "top" }, modal: true, close: function(event, ui) { location.reload(); } }).css("overflow", "auto"); $(function () { $('a.exampleLink').on('click', function (e) { e.preventDefault(); // TODO: Undo comments, below var url = $(this).attr('href'); $modalDialog.load(url, function(){ $( ".ewMenu" ).hide(); $( ".ewHeaderRow" ).hide(); $('h4').hide(); $( "#btnCancel" ).hide(); $( ".ewToolbar" ).hide(); $( ".ewFooterRow" ).hide(); }); $modalDialog.dialog("open"); }); });

最满意答案

试试这个(btnCancel的例子):

$modalDialog.find("#btnCancel").hide();

Try this (example for btnCancel):

$modalDialog.find("#btnCancel").hide();

更多推荐

本文发布于:2023-07-15 22:07:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119400.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:内容   对话框中   jQuery   ulr   load

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!