如何解决是否可以克隆或复制 thead 并最终得到相同宽度的 jquery
找到 this 我和我不确定我的假设是否正确。不可能克隆或复制 thead
并最终得到相同宽度的相同 thead
?
在一个单独的项目中,我遇到了同样的问题..我正在创建一个 thead,然后处理原始 thead 的 html 并将它们放在一个克隆 thead 中,但我的问题是宽度不一样。
这是我如何实施我的流程:
var i = [];
var $original = $(this).find(".spec-table__thead.spec-table__thead--original th p");
//getting width of original
$original.each(function(index) {
i[index] = $(this).width();
});
var n = $(this).find(".spec-table__thead").html(),o = $('<thead class="spec-table__thead spec-table__thead--clone">' + n + "</thead>");
//creating the clone thead
var $clone = $(this).find(".spec-table__thead--clone th p");
$("#spectablecontent").on('custom-update','.spec-table__thead--clone',//function(index) {
// console.log(i[index])
//});
//assigning the width to cloned thead
//here im not getting the width from the original thead correctly
$clone.each(function(index) {
console.log(i[index])
$(this).width(i[index]);
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。