Sets the text content of the Element it is called on, possibly overriding any existing text or element nodes.
setText(text)<, >, &, " and ') before creating the text node, thus HTML code passed as parameter will be displayed as text rather than parsed into a DOM structure. If you want to parse HTML code, please use the .setHtml() function instead.Simple example:
let foo = document.getElementById('foo'); foo.setText('Hello, world!');