I am just new learner in javascript, I was going through DOM manipulation in javascript or jquery
I was trying to catch the 'p' tag which was in my javascript variable but does not work can someone please do the necessary correction.
Answer can be given using javascript or jquery both works for me
I also had some similar question here (Getting tags when whole HTML page is in one javascript variable)[sorry for the confusing explanation in this question]
<!DOCTYPE html>
<html>
<body>
<p>The DOM is very useful!</p>
<p>This example demonstrates the <b>getElementsByTagName</b> method.</p>
<script>
var myHTML ='<p>Hello World</p>'
x=myHTML.getElementsByTagName("p");
document.write("Text of first paragraph: " + x[0].innerHTML);
</script>
</body>
</html>
I have already seen this similar question get-content-of-a-div-using-javascript and dom-javascript-get-text-after-tag
which does not answer my question
My Scenario is
I have all html page in one javascript variable and I need to append it to my page but we can not do it since you can not have two body or HTML tag . so I need to split it by tag ..... but whole element is in javascript variable! so how do I do it?