I'm struggling with the once function. The once callback function is not called. I'm trying to use like this:
(function ($, Drupal){
Drupal.behaviors.my_module = {
attach: function (context, settings) {
console.log('this runs');
$('.my_selector', document).once('special-mark', function() {
console.log('this never called');
});
console.log('this also called');
}
}
})(jQuery, Drupal);
In the library file I use the following:
dependencies:
- core/jquery
- core/jquery.once
- core/drupal
There's no a single error in the console. It's just simply not called the callback... How can I make it work?
Drupal: 8.8.4
jQuery: 3.4.1