title: javascript get html or text from div
body: <p>This is easy in jquery but how about plain javascript?</p>
  
  <p>The code is for the Google image search API. I want to search images that match the html or preferably text inside a div.</p>
  
  <pre><code>var searchThis = document.getElementById('imgToFind'); //get HTML, or text from div
  
  // Find images
  imageSearch.execute(searchThis); //search image
  </code></pre>
  
  <p>The HTML</p>
  
  <pre><code>&lt;div id="imgToFind"&gt;PlayStation&lt;/div&gt;
  </code></pre>
  
  <p>The result should be images of playstation. Instead I get these </p>
  
  <p><img src="https://i.stack.imgur.com/lX1It.jpg" alt="1"> dosic ois - 123</p>
  
  <p><img src="https://i.stack.imgur.com/A1hEh.jpg" alt="alt text"> IE8 javascript returns [object HTMLDivElement] instead [</p>
  
  <p><img src="https://i.stack.imgur.com/a19PN.jpg" alt="alt text"> Loving Hand</p>
  
  <p>And other irrelevant images. I wonder what Google searches for.. think the second one is giving me a hint. </p>