Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I add a javascript to a single node in drupal 7?

How do I add a specific javascript to a specific node in drupal 7? Right now i add my .js javascript via the "javascript librairies" module. But this adds the .js to all nodes. I want to have myjavascript1.js enabled for node 1 and myjavascript2.je available for node 2?

Is there a way to acheive that? DO I have to make my own module?

like image 757
Baba Avatar asked Nov 04 '22 07:11

Baba


1 Answers

You can create node--[nid].tpl.php file for specific node id and after that you can use your specific js file for specific node id.

like image 90
vishnu modi Avatar answered Nov 12 '22 12:11

vishnu modi