title: JavaScript getElementsById from variable
body: <p>i would like to ask you how can i get elements by id from variable in JavaScript. For example i have in JavaScript variable which contains html source code and i would like to get elements from this variable.</p>
  
  <p>For example:</p>
  
  <pre><code>var html = "&lt;html&gt;&lt;body&gt;&lt;div id='test'&gt;Hi&lt;/div&gt; ... lot of code ... &lt;div id='test'&gt;Hi&lt;/div&gt;&lt;div id='test'&gt;Hi&lt;/div&gt; ... lot of code ... &lt;/body&gt;&lt;/html&gt;";
  
  var get = html.getElementsById("test");
  </code></pre>
  
  <p>But it's not working</p>
  
  <p>Thank you so much for any help</p>