title: JS wait for DOM changes
body: <p>I have a js file that modifies the DOM of a page, adds a nav menu. After that code is another function that modifies the resulting nav menu. The issue is unless I set a timeout to wait for the DOM to be changed I can not guarantee the final code will work as intended. Is there a more guaranteed method of invoking this final code (a 2nd DOM manipulation dependent on the 1st completing) than setTimeout()? </p>
  
  <p>edit 1:
  function being called</p>
  
  <pre><code> $(document).ready(function() {
          // do stuff;
      });
  </code></pre>