Add a function to OnLoad in Drupal

旧巷老猫 提交于 2019-12-22 18:33:04

问题


I have a HTML/text default module in the left bar of one of my skins/themes. I have some Javascript in there I'm trying to set today date to my javascript date dropdowns. I am unable to use 'body.onLoad' because Drupal is blocking it somehow?

I found a solution saying I can add my javascript function here: if (isJsEnabled()) { addLoadEvent(yourCustomJSFunction); }

How can I add that if I'm just using a default HTML/text module?

Thanks!


回答1:


Drupal uses the jQuery JavaScript library. Any JavaScript you write to work with Drupal should ideally use jQuery as well. Check out the JavaScript Startup Guide on api.drupal.org for some basics, particularly the Drupal.behaviors section.



来源:https://stackoverflow.com/questions/1717373/add-a-function-to-onload-in-drupal

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!