Using JQuery in Drupal 7

前端 未结 5 612
长情又很酷
长情又很酷 2021-01-30 17:18

I\'m writing my own Drupal 7 module, and like to use JQuery in it.

$(\'#field\').toggle();

But I\'m getting this error:

TypeErr         


        
5条回答
  •  隐瞒了意图╮
    2021-01-30 17:49

    You can create the separate file for js and than add js file using the following:

    drupal_add_js('path', 'module_name');
    

提交回复
热议问题