Drupal behaviors - jQuery Once

By kenneth, Mon, 11/08/2021 - 11:14
(function ($, Drupal, drupalSettings) {
   'use strict';  
    
   Drupal.behaviors.my_behavior =  {
    attach: function (context, settings) {
      $(document, context).once('my_behavior').each( function() {
        myInit();
      });
    }
  }
} (jQuery, Drupal, drupalSettings));