如何通过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();更多推荐
发布评论