title: Understanding how Greasemonkey runs user scripts
body: <p>I'm learning Greasemonkey with the hopes of making some improvements to a webpage.</p>
  
  <p>I think I have a good grasp of JavaScript, but I don't understand at what point in the rendering of the document the Greasemonkey user script is executed. </p>
  
  <p>For instance, what if there is JavaScript natively inside the document that inserts some elements to the page. I want my Greasemonkey script to run only after that JS completes. </p>
  
  <p>Let's say this is the document that I'm trying to modify with Greasemonkey</p>
  
  <pre><code>&lt;html&gt;
   &lt;script&gt;
     //insert a button with id="mybutton"
   &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I want the <code>&lt;script&gt;</code> code to complete before my Greasemonkey script is run, because I want to alter its background color.</p>