title: access to DOM add dynamiclly, getScript, ajax
body: <p>I use jQuery ajax to read context on my page dynamicly. But part of DOM is load in javaScript function call by getScript in ajax .done. But just after I load new content I need to get elements by class and use it in next function. Unfortunatly I can't find elements, that I create in javaScript function, and script with that function I call using jQuery getScript.</p>
  
  <p>ok, my code:</p>
  
  <pre><code>$(document).ready(function() {
      $('.link').click(function(){
        var subpage = $(this).attr('data-subpage');
        var src = 'subpages/'+ subpage + '/' + subpage +'.php';
        var script = 'subpages/'+ subpage + '/js/' + subpage +'.js';
  
        $.ajax({
            url: src,
            context: document.body,
            dataType: 'html',
            success: function(responseText){
                $('#text').html(responseText); // responseText has only container &lt;div id="insideText"&gt;&lt;/div&gt; that I use in one function and load there by html() several divs. One of this div has class 'translate'. I need it in function Translator
              }
        })
          .done(function(){
            $.getScript(script); // here I call script where I load several divs to #insideText
            Translator($('.active').attr('data-lang')).getTranslation() // part of function have to find all div.translate, but can't find it if they're load in script call in getScript. And this is a problem.
          })
      })
    })
  </code></pre>
  
  <p>I hope, I explaine my problem quite clear. If not, plaese ask, I'll try again.</p>
  
  <p>There's some way to do that?</p>
  
  <p>//update//</p>
  
  <p>After this script, call by getScript I still have problem with second 'done':</p>
  
  <pre><code>  const Presenter = function(){
      var presented, show, fullDesc, cont;
  
      presented = [
        {
        url: 'demo/colorsGame/',
        name: 'Graj w kolorki!',
        desc: 'Graj w kolorki! Wybierz taki sam kolor, w jakim napisana jest nazwa wylosowanego koloru. Spiesz się, czas ucieka coraz szybciej i szybciej. Uważaj, bo mózg może cię oszukać i uznać za ważniejsze to, co jest napisane, a nie to co widzisz. Zobacz ile punktów jesteś w stanie zdobyć zanim popełnisz trzy błędy. Ćwicz swoją koncentrację.'
      },
      {
        url: 'demo/sampleUserProfile/',
        name: 'Sample User Profil',
        desc: 'Mała próbka możliwości reactJS. Wkonany z użyciem biblioteki reactJS, menadzera pakietów webpack oraz na środowisku nodeJS przykładowy profil użytkownika. Like-uj i obserwuj do woli, a jeśli chcesz, wypowiedz się pod profilem.'
      }
    ];
  
      show = function(url, desc, name) {
        fullDesc =
          "&lt;a href ='" + url + "'&gt;" +
            "&lt;h1 class='translate'&gt;" + name + "&lt;/h1&gt;" +
          "&lt;/a&gt;" +
          "&lt;div&gt;" +
            "&lt;p class='translate'&gt;" + desc + "&lt;/p&gt;" +
          "&lt;/div&gt;";
  
        cont =
          "&lt;div id='webmin' class='clearfix'&gt;" +
            "&lt;div&gt;" +
              fullDesc +
            "&lt;/div&gt;" +
            "&lt;div&gt;" +
              "&lt;iframe src='" + url + "' scrolling='no'&gt;" +
                "ups, twoja przeglądarka nie obsługuje ramek" +
              "&lt;/iframe&gt;" +
            "&lt;/div&gt;"+
          "&lt;/div&gt;";
  
        return cont;
      };
  
      return {
        show: show,
        presented: presented
      }
    };
  
    display = function(){
      var len, url, name, desc;
  
      len = Presenter().presented.length;
  
      for(let i = 0; i &lt;= len; i++){
        url = Presenter().presented[i].url;
        name = Presenter().presented[i].name;
        desc = Presenter().presented[i].desc;
  
        $('#insidetext.apps').append(Presenter().show(url, desc, name));
      }
    };
    display();
  </code></pre>
  
  <p>Hmm, I'm wondering, if iframe is not a problem here? And don't let script to be done to end?</p>