title: Using Javascript to grab element on remote page
body: <p>I would like to grab an element from a remote HTML page. As I am requesting data from a different domain I am using the below code to add the source as a script. Yes, very dodgy.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var script = document.createElement('script');
      script.setAttribute('type', 'text/javascript');
      script.setAttribute('src', 'http://remoteDomain.com/page.html');
      document.getElementsByTagName('head')[0].appendChild(script);
  &lt;/script&gt;
  </code></pre>
  
  <p>The above code fetches and appends the entire page to my document head. Seems to work okay. However now I would like to able to grab an element by ID, or even regex from this source. </p>
  
  <p>Can this be done?</p>
  
  <p>I am aware that the above code is dirty, so I'd be happy to receive any suggestions to clean it up!</p>