I have query some data and result is like this
<p><img src="xxx.png" alt="" style="margin:5px;" /><br></p><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.<br></p>
show on console. I want to remove all html tag from this data and get only string like this
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type.
Anyone know how to remove single and double quote from this data or some solution. Thanks
You can create a temporary element and read it's .textContent property:
var d = document.createElement('div');
d.innerHTML = htmlContent;
var textContent = d.textContent || d.innerText;
If you can use jQuery:
var textContent = $('<div/>').html(htmlContent).text();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With