3

Drupal disables the $ namespace for jQuery, to avoid potential conflicts with other libraries. Therefore the wrapping $() DOM-ready-function will neither be executed, nor can the $('#something') selector be used inside. Wrap your behavior with this instead: (function ($, Drupal) { //inside the wrapper you can use the usual jQuery $ notation Drupal....


2

I don't think you can force javascript to only run once. In addition to big pipe, any lazy loader, ajax form update (consider entity reference fields), or other ajax functionality on the page can trigger javascript to run again. This is the issue that jQuery.once() addresses, and the reason it is used. It adds a class on the element, then executes on ...


1

I was missing the File Entity module. Installed it and was good to go. Also, was having trouble when using normal json format. Switched to hal_json and that got it.


1

This issue is usually -- but not always -- because someone has written Javascript without adding semicolons in the appropriate places. JS is valid without them but only when there is also a line-end at that point. Many JS preprocessors remove line breaks, so making the JS invalid. This can be resolved by examining the JS source for missing semicolons and ...


Only top voted, non community-wiki answers of a minimum length are eligible