How to capture the scroll
event for HTML element that using Select2
?
I want to capture the scroll event for dynamically adding <option>
into my dropdown.
For your infomation:
- I'm using
jQuery
, and the dropdown usingSelect2
. - The
id
that of my HTML element isd
. (Although the naming isn't appropriate, will rename it later)
Testing solution 1: (Not working)
$("body").on("scroll", "#select2-d-results", function(){
alert('scroll');
})
Testing solution 2: (Not working)
$('#select2-d-results').scroll(function() {
alert('scroll');
});