(function ($, Drupal) { Drupal.behaviors.myAwesomeJs = { attach: function attach(context, settings) { //js goes here } }; })(jQuery, Drupal);