What is the difference between scroll() and on('scroll', function() {...});?

Good afternoon.
Please tell me what the difference is between $(document).scroll( function() {...} ); and $(document).on( 'scroll', function() {...} )
April 4th 20 at 13:20
1 answer
April 4th 20 at 13:22
scroll(handler) is an alias of $(document).on( 'scroll', handler). But in the second case you can use the syntax $(document).on('scroll', selector, handler) that allows you to attach events to selectors, not elements (the processor will work on those elements that are not yet on the page).
Thank you very much) - pearl.Larson76 commented on April 4th 20 at 13:25

Find more questions by tags jQuery