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