jQuery document.createElement等价? - jQuery document.createElement equivalent?

问题:

I'm refactoring some old JavaScript code and there's a lot of DOM manipulation going on. 我正在重构一些旧的JavaScript代码,而且正在进行大量的DOM操做。 app

var d = document;
var odv = d.createElement("div");
odv.style.display = "none";
this.OuterDiv = odv;

var t = d.createElement("table");
t.cellSpacing = 0;
t.className = "text";
odv.appendChild(t);

I would like to know if there is a better way to do this using jQuery. 我想知道是否有更好的方法来使用jQuery。 I've been experimenting with: 我一直在尝试: ui

var odv = $.create("div");
$.append(odv);
// And many more

But I'm not sure if this is any better. 但我不肯定这是否更好。 this


解决方案:

参考一: https://stackoom.com/question/17qU/jQuery-document-createElement等价
参考二: https://oldbug.net/q/17qU/jQuery-document-createElement-equivalent
相关文章
相关标签/搜索