0
$( document ).ready(function() {
    $('a').on('mouseover', function(e) {
    e.preventDefault();

       var addressValue = $(this).attr("href");
      // console.log(addressValue);
       if (addressValue.substring(0, 12) == "http://t.co/")
        console.log(addressValue);

       //var a = '.' + srcElement.className;
     //  $(this).tooltipster({
       //         content: $("<span><strong>" + addressValue + "</strong></span>")
        //    });

  });
});

This code of mine helps me get href links out of all the links loaded in a window, but when I start scrolling, this doesn't get called anymore.

How to make it work for all the href tags loaded on scroll?

IamH1kc
  • 6,602
  • 4
  • 19
  • 17

1 Answers1

1

You need this:

$( document ).ready(function() {
    $(document).on('mouseover', 'a', function(e) {
    e.preventDefault();

       var addressValue = $(this).attr("href");
      // console.log(addressValue);
       if (addressValue.substring(0, 12) == "http://t.co/")
        console.log(addressValue);

       //var a = '.' + srcElement.className;
     //  $(this).tooltipster({
       //         content: $("<span><strong>" + addressValue + "</strong></span>")
        //    });

  });
});
Sharikov Vladislav
  • 7,049
  • 9
  • 50
  • 87