How to bind event on dynamic element

i use Infinite Scroll to load items and every item need to bind click event, but binding is not working like ‘$$(’.item’).on(‘click’, function{})’, this ‘on’ does not like jquery ‘on’, it cant bind dynamic element. how can i do it gracefully? thanks

1 Like

do something like this

$$(document).on('click', 'a', function (e) {
  console.log('link clicked');
});
2 Likes