Internet Explorer正在复制隐藏的表格元素 [英] Internet Explorer is copying hidden table elements

查看:139
本文介绍了Internet Explorer正在复制隐藏的表格元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jquery命令在以下jfiddle中找到:
https:// jsfiddle。 net / esend7881 / 3uu0tpv1 / 2 /

I am using jquery command found in the following jfiddle: https://jsfiddle.net/esend7881/3uu0tpv1/2/

也就是说,我使用的是:

Namely, I am using:

$(document).ready(function () {
    $('table#safe-distances-table').dblclick(function () {
        $('tr.no-impact').toggle('slow');
    });
});

在表格被双击时,HTML表格中的某些行会被关闭。 Jquery工作正常,但我的真正的问题是从Internet Explorer复制和粘贴。

To cause some rows in an HTML table to toggle off when the table is double clicked. Jquery is working fine, but my real problem is copying and pasting from Internet Explorer.

我只能在一些环境中使用Internet Explorer,而且我期望当行被隐藏,我从IE复制和粘贴表到Outlook,隐藏的行不会随之而来。相反,他们是!

I am limited to using Internet Explorer in some enviornments and I am expecting that when rows are hidden and I copy and paste the table from I.E. to Outlook, the hidden rows will not come with it. Instead, they are!

您可以尝试在Internet Explorer的JFiddle。双击表格后,尝试复制并将整个表格粘贴到Outlook中,您将看到所有行出现!

You can try in the JFiddle with Internet Explorer. After double clicking on the table, try copying and pasting the full table into Outlook and you will see all the rows appear!

推荐答案

您需要 remove() 隐藏的行,然后再复制它们。

You'll need to remove() the hidden rows before you copy them. It makes putting the rows back on double click a little bit fiddly - you'll need to keep track of the original data before you remove them.

$('table#safe-distances-table').dblclick(function () {
    var $el = $(this);
    if($el.data('toggled')){
        $el.html($el.data('all'));
        var $rowsToHide = $('tr.no-impact');
        $rowsToHide.hide();
        $rowsToHide.toggle('slow');
        $el.data('toggled',false);
    } else {
        var $rowsToHide = $('tr.no-impact');
        $el.data('all', $el.html());
        $rowsToHide.toggle('slow', function(){
            $rowsToHide.remove();
        });
        $el.data('toggled',true);
    }
});

这篇关于Internet Explorer正在复制隐藏的表格元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆