> For the complete documentation index, see [llms.txt](https://docs.clipbucket.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clipbucket.com/guides/functions/add_js.md).

# add\_js

### add\_js

ClipBucket has a very useful function that is used to add Js file in ClipBucjet template so that you dont need to add js file in each template seperately, all you have to do is to add a little code and your file will be included in all templates

usage

add\_js(array\[]);

explanation

array(“file”=>”scope”);

file

Make sure your file is placed in /js directory, e.g if you want to call my.js , you first place it in /js directory and then add array(“my.js”=>”watch\_video”); , similarly if your file in /js/somefolder/myfile.js , you will add it array(“somefolder/myfile.js”=>”watch\_video”);

scope

scope basically tells the clipbucket in which files we should include this file , ie , watch\_video, home, view\_channel etc…  or say for each **file\_name.php** scope name is file\_name. ok , if you add

array(“my.js”=>”watch\_video”); array(“my.js”=>”view\_channel”); array(“my.js”=>”view\_group”);

it will include my.js file in all these “watch\_video” , “view\_channel” and “view\_group” files..\
if you want to add my.js in all files, simply, call function as follow

array(“my.js”=>”global”);

![](https://clipbucket.com/docs/wp-content/plugins/wp-postratings/images/loading.gif)Loading...
