KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm writing a custom widget that requires some supporting javascript code that I need output somehwere. The options are: Dump it right after the html code. Append it to the form's media. Append it to a global onReady section. My gut instinct is to avoid things like: <!-- original widget output --> <input id="date" /> <-- Appended javascript --> <script type="text/javascript"> jQuery('#date').datepicker() </script> Instead, I've opted for item 3) most recently in my PHP projects. Does Django have a nice way of doing 2 or 3? I'm hoping that I can utilize this methodology from the context of my widget's render function. This may preclude option 2) if my widget doesn't have a any idea of the form it's on.
Tags (comma-separated)
Save Edits
Cancel