How can I add jQuery to DOM element through drupal.behaviours?
Here's a skeleton of how you can add functionality to elements using Drupal.behaviors.

(function ($, Drupal) {
  'use strict';

  // Create a new function for each element the file attaches
  // handlers to. In this case, $(.secondary-action')
  function secondaryEventListener(context) {
    // Find the elements, ensure that any internal code is executed
    // a single time using $.once(), then loop through the found elements
    // using $.each()
    $(context).find('.secondary-action').once('secondary-event-listener').each(function () {
      // $(this) refers to the current instance of $('secondary-action')
      $(this).click(function () {
        alert("clicked");
      });
    });
  }

  Drupal.behaviors.someArbitraryButUniqueKey = {
    attach: function(context, settings) {
      // Call your function containing the handlers
      secondaryEventListener(context);
    }
  };
}(jQuery, Drupal));