addJavaScript

Navigation:  Development > Function Reference > Helpers > Html >

addJavaScript

Previous pageReturn to chapter overviewNext page

This function used to add JavaScript in document. It create as Script tag to attached JS. See below example:

 

App::Html()->addJavaScript(SRC);

 

SRC: Source path of the script. If we do not pass full path the system automatically add base URL.
 
echo App::Html()->addCSS("/js/print.js");
<script type="text/javascript" src="http://www.example.com/js/pring.js"></script>

 

 

echo App::Html()->addCSS("http://s7.addthis.com/js/250/addthis_widget.js");

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>