This is my code:
console.log($('p').html())
<p><span data-htmlContent="<p>This is not really in ap tag.</p>">.</span>.</p>
In Chrome and older FireFox the console logs: <span data-htmlcontent="<p>This is not really in ap tag.</p>">.</span>.
But in IE and newer FireFox it logs: <span data-htmlcontent="<p>This is not really in ap tag.</p>">.</span>.
Problem can be seen here: http://jsfiddle.net/Nzj52/9/
It may have something to do with how each browsers console operates compared to the rendering operation. If you did and alert instead - would your answer change?
Instead of calling console.log($('p').html()); Try calling console.log($('p').text());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.