title: $(window).bind("load") and $(element).html in pure javascript
body: <p>I am trying to change this jquery to pure javascript:</p>
  
  <pre><code>var subContainerElement = $('#' + mainContainerId).find('#' + subContainer);
  
  $(window).bind("load", function () {
      $(subContainerElement).html(function (index, text) {
  
          newParagraphText = text.replace("aaa", "bbb");
          return newParagraphText;
      });        
  });
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>var subContainerElement = mainContainer.getElementsByClassName(subContainer)[0];
  
  document.addEventListener("DOMContentLoaded", function(event) {
  
      mainContainer.getElementsByClassName(subContainer)[0].innerHTML = 
      function (index, text) {
  
          newParagraphText = text.replace("aaa", "bbb");                 
          return newParagraphText;
      };
  });
  </code></pre>
  
  <p>Unfortunately, the innerHTML function set the html of the element to be:</p>
  
  <p><code>function (index, text) { ......</code></p>
  
  <p>Any help appreciated.</p>