Javascript on widgets

Hi, guys!
I’m stuck on implementing a Widget because I can’t get it fully working, since it depends of some javascript code to show me some progress. The widget full view is working well, with its js functions running, but nothing when I watch the widget inside content studio. Anyone can help me to solve that?

What is the problem exactly? Is the JavaScript in your widget not loading in Content Studio?

Maybe you can check the Chuck Norris app code as a reference. It’s a nice and simple example of widget:

https://github.com/enonic/app-chucknorris

  • I have a widget
  • The widget view implements jQuery
  • jQuery doesn’t work, unless I’m on the widget full view. Ex: a url like “/admin/portal/admin/draft/_/widgets/[myApp]/[myWidget]”;

Chuck Norris app doesn’t apply any frontend javascript on its view =\

Maybe it needs to run with jQuery.noConflict()?

How and where do you add a reference to jQuery lib - via local assets or remotely? Did you check your browser console to see if the jQuery js-file(s) were loaded without errors?

On the header of widget’s html, tried via external font and local file but no success, also, no browser errors

Loading time of scripts might be different in content studio and online. Be very explisit to ensure that libs are not loaded earlier in content studio or in production.