title: Get content from another page with JavaScript
body: <p>How to load divs from page 2 into page 1 with JavaScript.</p>
  
  <p>Page2.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt; title &lt;/title&gt;
  &lt;body&gt;
  &lt;div id="main"&gt;
  &lt;div id="content2"&gt; this is content2&lt;/div&gt;
  &lt;div id="content3"&gt; this is content3&lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want to get and use the id content2 from page2 to create a div into page1 with the content of that div, after link was clicked and deleted, and do the same with content3, content4 and successively.</p>
  
  <p>Page1.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt; title &lt;/title&gt;
  &lt;body&gt;
  &lt;div id="main"&gt;
  &lt;div id="content1"&gt; this is content1&lt;/div&gt;
  &lt;a href="#"&gt; get content&lt;/a&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And then would be like that.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt; title &lt;/title&gt;
  &lt;body&gt;
  &lt;div id="main"&gt;
  &lt;div id="content1"&gt; this is content1&lt;/div&gt;
  &lt;div&gt;this is content2&lt;/div&gt;
  &lt;div&gt;this is content3&lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm new in JavaScript and i have no ideia how to do that. If someone can help. Thanks.</p>
  
  <p>Edited: I wanted a way to do it only with javascript and without jquery if that's really possible. I want my project working offline and I can't do that with jquery, because it doesn't work. I've downloaded jquery plugin and pasted it in my directory, but, didn't work, too.</p>