To get the pure text without HTML element using JavaScript, we can use the textContent
property.
For instance, we write
const element = document.getElementById("txt");
const text = element.textContent;
to select the element with getElementById
.
And then we get the textContent
property to get the pure text inside the element.