Title: Missing Javascript Element in Sidebar
Last modified: August 21, 2016

---

# Missing Javascript Element in Sidebar

 *  Resolved [herold](https://wordpress.org/support/users/herold/)
 * (@herold)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/missing-javascript-element-in-sidebar/)
 * I have installed your plugin and it works great – fantastic improvement in loading
   time. Even I had optimized things before. The only problem I have is one page
   with a javascript element in the sidebar. It does no longer show up. I have included
   the CSS and the JS file in the list of excluded files, but no luck. I also changed
   the priority of the script when it is loaded. Any ideas how to resolve it?
 * Here is the script I am using:
    [http://codecanyon.net/item/jquery-goal-thermometer/6358236](http://codecanyon.net/item/jquery-goal-thermometer/6358236)
 * Thank you
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/missing-javascript-element-in-sidebar/#post-5034785)
 * Can I see that running on your site somewhere? Feel free to mail me (futtta at
   gmail dot com) if you prefer not to post the URL here.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/missing-javascript-element-in-sidebar/#post-5034970)
 * This got solved after some mailing back and fro, but part of the solution merits
   to be documented.
 * Problem was the the javascript in the sidebar relied on jquery. Once both the
   sidebar-js and jquery were excluded, all worked OK.
 * But taking it one step further; as the sidebar-jquery only was shown on one particular
   case, I propsed the following Autoptimize-API based code to only execute the 
   exclusion on a particular page (e.g. on [http://blog.url.net/funtastic/](http://blog.url.net/funtastic/));
 *     ```
       add_filter('autoptimize_filter_js_exclude','herold_ao_override_jsexclude',10,1);
       function herold_ao_override_jsexclude($exclude) {
           if (strpos($_SERVER['REQUEST_URI'],'funtastic')!==false) {
               return $exclude.", goal.js, jquery.min.js";
           } else {
               return $exclude;
           }
       }
       ```
   
 *  Thread Starter [herold](https://wordpress.org/support/users/herold/)
 * (@herold)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/missing-javascript-element-in-sidebar/#post-5034971)
 * Hello Frank,
 * Thank you for the support and the custom solution, which works perfect.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/missing-javascript-element-in-sidebar/#post-5034972)
 * Glad to hear that Herold!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Missing Javascript Element in Sidebar’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/missing-javascript-element-in-sidebar/#post-5034972)
 * Status: resolved