What Is A Text Node, Its Uses? //document.createTextNode()

前端 未结 2 2096
失恋的感觉
失恋的感觉 2020-11-28 04:55

So I\'ve been slowly replacing a lot of my normal jQuery code with native javascript, and I happened upon the document.createTextNode() and related MDN document

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-28 05:53

    innerText get and set the content as plain text, encode and decode. When innerHTML get and set the content in HTML format.

    var div = document.createElement('div');
    div.innerText = 'Y HALO THAR';
    

提交回复
热议问题