title: Include existing jquery functions on ajax loaded elements Jquery
body: <p>I have some functions at the end of my HTML which use jquery to do some stuff</p>
  
  <pre><code>function transformacija() {
      if ($("#drugiPrviPage").hasClass("pocetna")) {
          $("#drugiPrviPage").velocity({
                  left: "-100%",
                  opacity: 0.3
              },
              "slow"
          )
          $("#drugiPodPage").velocity({
                  right: "10%",
                  opacity: 1
              },
              "slow"
          )
      } else {
          $("#drugiPrviPage").velocity({
                  left: "10%",
                  opacity: 1
              },
              "slow"
          )
          $("#drugiPodPage").velocity({
                  right: "-100%",
                  opacity: 0.3
              },
              "slow"
          )
          $("#prviPage").removeClass("pocetna");
          $("#drugiPodPage").empty();
  
      }
  
  }
  
  
  
  $(".prvilinkovi").click(function() {
      var id = $(this).attr('id');
      var idt = id + '.txt';
      $(document).ajax({
          url: [idt],
          type: "GET",
          cache: false,
          success: function(txt) {
              $("#drugiPodPage").html(txt);
  
          }
      });
      transformacija();
  
  });
  }
  </code></pre>
  
  <p>Basicly when i click the button with class "prvilinkovi" i'm loading content into a div with ajax and then i have the same button on the ajax loaded div and i want it to have the same function as button that initialy clicked. I added class "pocetna" to the ajaxloaded button but it doesn't have the functions like the first button.</p>
  
  <p>How could i delegate the functions to work on the ajax loaded content?</p>
  
  <p>I've tried puting the code into an init function and call it on ajaxcomplete event but it doesn't seem to work at all then (even though i used on document.ready() to call the init function aswell.</p>
  
  <p>I went for this method of ajax loading to dinamicly load page parts when clicked upon a category with a cool velocity animation to have the onepage model for the website and when u go back it empties the div and is ready for the next category click.</p>