📜  js 字符串到节点 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:26.692000             🧑  作者: Mango

代码示例1
function createElementFromHTML(htmlString) {
  var div = document.createElement('div');
  div.innerHTML = htmlString.trim();

  // Change this to div.childNodes to support multiple top-level nodes
  return div.firstChild; 
}