[support] javascript after document loaded
Seth Freach
sfreach at gmail.com
Fri Jul 31 18:59:41 UTC 2009
Gary,
for quick and simple in your module, use:
<code>
drupal_add_js('
$(document).ready(function() {
alert("This ran after the DOM was loaded.");
});
', 'inline');
</code>
...replacing the alert with whatever it is you need to do.
-Seth
garyl wrote:
> I have a single javascript function i want to call when a page has
> loaded.
>
> I haven't used jQuery before but have found the $(document).ready
> option. Can I use this to run my javascript and if so do where do I
> put my code. Would rather not put in a module unless it's necessary...
>
> Many thanks
> Gary
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
More information about the support
mailing list