Bug #5609
closed
jquery inside widgets need to be added manually
Added by jeroen van breedam over 8 years ago.
Updated over 8 years ago.
Description
is it intended that you'd need to manually set static paths to the various jquery*.js files inside the widgets ?
- Status changed from New to Feedback
- Assignee set to jeroen van breedam
No. Not unless you are calling a function that is unique to your package (ie not included by foot.inc)
Note that jQuery is loaded by foot.inc so it may not have been loaded by the time you first call it. The solution is to wrap your jQuery in events.push like this:
events.push(function(){
$('#mytextbox').text("Hello");
});
yes that works with jquery inside a <somewidget.php> file.
however i can't get that solution to work with a <somewidget.js> file in /usr/local/www/widgets/javascript/
if i put them functions inside an events.push(), then they just don't execute.
I'm probably missing something obvious.
It might be instructive to look at the thermal sensors widget. It uses a .js from widgets/javascript, and that js file contains jquery calls.
- Category set to Web Interface
- Status changed from Feedback to Closed
Also available in: Atom
PDF