I have the following tag :
<div id="title"> <script>alert(10)</script></div>
text = $("#title").text().trim();
This gives me the output : <script>alert(10)</script>
It automatically escapes the Html characters.
I want to avoid this as this text variable may be used elsewhere which could lead to XSS. How can i avoid escaping this html and take the text inside the title as it is.