Create node from markup string

前端 未结 3 483
心在旅途
心在旅途 2021-01-12 22:30

Is there a way to convert markup string to node object in JavaScript? Actually I am looking for the subsitute for:

document.getElementById(\"divOne\").innerH         


        
3条回答
  •  难免孤独
    2021-01-12 23:23

    Yes, you can do that.

    var myNewTable = document.createElement("table");
    myNewTable.innerHTML = ""
    document.getElementById("divOne").appendChild(myNewTable);
    

提交回复
热议问题