title: Manipulating DOM element using JavaScript or jquery
body: <p>I am just new learner in javascript, I was going through DOM manipulation in javascript or jquery </p>
  
  <p>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.</p>
  
  <p>Answer can be given using javascript or jquery both works for me </p>
  
  <p>I also had some similar question here (<a href="https://stackoverflow.com/questions/18279629/remove-specific-tags-from-html-while-avoiding-iframes">Getting tags when whole HTML page is in one javascript variable</a>)[sorry for the confusing explanation in this question]</p>
  
  <p><a href="http://www.w3schools.com/htmldom/tryit.asp?filename=try_getelementsbytagname" rel="nofollow noreferrer">W3Schools</a></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;p&gt;The DOM is very useful!&lt;/p&gt;
  &lt;p&gt;This example demonstrates the &lt;b&gt;getElementsByTagName&lt;/b&gt; method.&lt;/p&gt;
  
  &lt;script&gt;
  var myHTML ='&lt;p&gt;Hello World&lt;/p&gt;'
  x=myHTML.getElementsByTagName("p");
  document.write("Text of first paragraph: " + x[0].innerHTML);
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I have already seen this similar question <a href="https://stackoverflow.com/questions/9359565/dom-javascript-get-text-after-tag">get-content-of-a-div-using-javascript</a> and <a href="https://stackoverflow.com/questions/9359565/dom-javascript-get-text-after-tag">dom-javascript-get-text-after-tag</a></p>
  
  <p>which does not answer my question </p>
  
  <p><strong>My Scenario is</strong><br>
  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?</p>