Get exact html() with closing tag for which starting tag is missing

Currently for a body with HTML: hello</div><p>hai</p><span>Welcome</span> on alerting $('body').html() it alerts hello<p>hai</p><span>Welcome</span> .

Fiddle

But I want it to display hello</div><p>hai</p><span>Welcome</span> ie Alert HTML as it is written within the body.

I can see the exact code when I view the source-code of the page.I really dont know if client-side scripts are capable of displaying the output I asked.

Is it possible ?And if yes How?


You could make an ajax request, this way the HTML won't be parsed:

$.get(window.location.href,function(data){console.log(data);});

See DEMO

链接地址: http://www.djcxy.com/p/19392.html

上一篇: 使用Java Config混淆Spring Security匿名访问

下一篇: 使用结束标记获取确切的html(),其中缺少开始标记