$ is not a function

elfinder version: 2.1.56

jquery version: 1.8.3 / ui: 1.10.2

Within my environment an bug is occurring if an file is selected. This happends while adding an link to an ckeditor field ( the link window) and also while adding an image to an ckeditor field ( the image properties window).

After clicking the "browse server" button to open the elfinder window and doubleclicking a file icon (or using the menu item Select item) the error stated below is rendered:

Chrome:

Error in getFileCallback.

$ is not a function

Firefox / Edge:

Error in getFileCallback.

Object expected

The selected file / link is correctly added to the corresponding url / link field within the parent window. Looks like the elfinder window raises the error while it tries to automaticly close itself after the correct value is set within the earlier mentioned parent field.

The solution is to edit elfinder\editors\ckeditor\ckeditor.callback.js and

// replace this statement

  • $(window).off('beforeunload');

// with this one

  • jQuery(window).off('beforeunload');

It was originally posted on: https://www.drupal.org/project/elfinder/issues/2989815

Edited by Daniel Tamajon