{"id":990446,"date":"2009-02-17T08:18:43","date_gmt":"2009-02-17T08:18:43","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/using-javascript-in-plugin\/"},"modified":"2016-08-19T03:31:43","modified_gmt":"2016-08-19T03:31:43","slug":"using-javascript-in-plugin","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/using-javascript-in-plugin\/","title":{"rendered":"Using JavaScript  in Plugin"},"content":{"rendered":"<p>I have looked around and found a lot of information on this but can not get it to work in my plugin.  I have a .js file with several scripts in it that I want to load from my plugin.  I have the following code in my main plugin .php file but it doesn&#8217;t seem to load on my page.  Please help!<\/p>\n<p>function addJS() {<br \/>\n            wp_enqueue_script(&#8216;js_imagefade&#8217;, get_bloginfo(&#8216;wpurl&#8217;) . &#8216;\/wp-content\/plugins\/ImageFade\/ImageFade.js&#8217;,false,&#8217;.01&#8242;);<br \/>\n            }<\/p>\n<p>add_action(\u2019init\u2019, \u2018addJS\u2019);<\/p>\n","protected":false},"template":"","class_list":["post-990446","topic","type-topic","status-closed","hentry","topic-tag-javascript","topic-tag-wp_enqueue"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/990446","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/990446\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=990446"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}