Search code examples
jqueryscrollupdatingjquery-tooltip

DOM element not updated after post jquery response


Demo Page DOM element not updated after post jquery response I'm using this plug for jquery link combined with this script:

     $(document).ready(function() {
    $("#produtos_div").scroll(function() {
      if ($(this).scrollTop() + $(this).height() == $(this).get(0).scrollHeight) {
        $.ajax({
          type: "post",
          url: "more.php",
          success: function(data) {
              $("#produtos_div").append(data);
              $.post('addMenuShoppingCart.php', function(return){
                    $('#result').append(return);
                    stickytooltip.init("*[data-tooltip]", "mystickytooltip");
      })
          },
          error: function() {
          }
        });
 });

works when it is loaded but when u scroll and include the div elements from the post and try to reload the plug, there is an error: Object does not support this property or method. Since entering the new elements in a div with a new attr, but nothing works. If someone knows something please help.


Solution

  • I managed to solve, simply create a method to add a copy of which is init but with one less line which was reviewed:

    / * stickytooltip.stickynotice1 stickytooltip.stickynotice1.join = ('') * / 
    

    Thanks!