I have the following response from an HTTP get.
<HTML><BODY>Now='11/7/2017 4:08:34 PM' Process='chrome' SessionID=1 User='Local\User' Culture='en-US'<BR></BODY></HTML>
I need to get the data there in the body into a JSON object. So I tried to remove HTML tags. Though it is different, I have tried, as there in this solution. It works for HTML tags but not for <html>
itself.
I have tried also as below:
var content = "<HTML><BODY>Now='11/7/2017 4:08:34 PM' Process='chrome' SessionID=1 User='Local\User' Culture='en-US'<BR></BODY></HTML>";
var tag = document.createElement("html");
tag.outerHtml = content;
It gives the following error:
Uncaught DOMException: Failed to set the 'outerHTML' property on 'Element': This element has no parent node.
Though I know that it can be achieved with regex
, I want to do it without regex
.
Could someone resolve it?