Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This issue s very strange... I'm just trying to set a simple javascript from a custom module. Here is the code:
drupal_add_library('system','ui.datepicker');
drupal_add_library('system','ui.dialog');
drupal_add_js('Drupal.behaviors.midatepicker = function(context) {
jQuery("#edit-fecha-expiracion").datepicker();
}', 'inline');
I also tryed within this wrappers:
jQuery(document).ready(function(){ ... });
and this other:
(function ($) { ... })(jQuery);
The javascript code is simple enought, but if I set just an alert within the wrappers, the alert is executed BEFORE de page load. If I change the theme (to Bartik), the alert is executed after the page load, and the other code works fine...
Any idea what is going on, or may be I must include the javascript in a special way in order to work?
thanks in advance
Comments
Comment #1
akalam CreditAttribution: akalam commentedI solved it installing nice_menus module. Not having this module causes a javascript error that don't let work other javascripts.
That's minor but I think that a theme must not depend on other modules to work.