title: Livequery and DOMNodeInserted replacement for IE
body: <p>This question has been asked a few times on stackoverflow, but I have yet to come across a solution that suits my unique situation.</p>
  
  <p>I'm looking to replace deprecated code <code>livequery</code> and <code>DOMNodeInserted</code>. Examples shown below.</p>
  
  <p>I’m developing javascript for a 3rd party website we are required to use at work. Therefore, when my script is run the page has loaded and I have no access to the js file on the server. We use IE exclusively, the current version is IE11.</p>
  
  <p>I’ve read here that <code>livequery()</code> is useful in “rare case where you need to respond to DOM changes, and have no control over the jQuery that is causing those changes”. This is my situation exactly.</p>
  
  <p>I am a complete noob with this stuff but I’ve read MutationEvents/Observers can do this, but they are not compatible with IE. What I’ve read is beyond my understanding at this point anyway. </p>
  
  <p>Here is what I am trying to do: </p>
  
  <p>When a user clicks a tab on the 3rd party app, everything on that tab is dynamically created. I need to determine when the tab has finished loading - so I do this by checking for the existence of an element on the tab, and when it is created I know the tab has loaded.</p>
  
  <p>For this example, the tab includes an icon called 's_3_1_12_0_icon'. </p>
  
  <p>Both of these code snippets will trigger the desired result:</p>
  
  <pre><code>//Method 1: Using DOMNodeInserted
  $('body').on('DOMNodeInserted', function () {
      var elementExists = document.getElementById('s_3_1_12_0_icon');
      if (elementExists != null) { 
          alert('The element has just been created')
          $('body').off('DOMNodeInserted');
      }
  });
  
  //Method 2: Using Livequery
  $('#s_3_1_12_0_icon').livequery(function() {
      alert('The element has just been created')
      $('#s_3_1_12_0_icon').expire();
  });
  </code></pre>
  
  <p>But as mentioned, <code>livequery()</code> and <code>DOMNodeInserted</code> are depricated. Is there a modern method of doing this? </p>