Title: Not Working &#8211; scripting issue
Last modified: February 10, 2023

---

# Not Working – scripting issue

 *  [DaveWP196](https://wordpress.org/support/users/davewp196/)
 * (@davewp196)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/not-working-scripting-issue/)
 * There appears to be a problem with the query-monitor.js script, in that assumes
   the “query-monitor-main” block has been loaded. If you move the line “window.
   addEventListener(‘load’, function() {” to before the test for whether jQuery 
   has been defined, (line 48) then everything works OK.
 * I found that the code to initialise container was being run before the element“
   query-monitor-main” was defined. The result is that whilst you can see the Query
   Monitor on the page, you are unable to interact with the facility.

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

 *  Plugin Author [John Blackbourn](https://wordpress.org/support/users/johnbillion/)
 * (@johnbillion)
 * WordPress Core Developer
 * [3 years, 4 months ago](https://wordpress.org/support/topic/not-working-scripting-issue/#post-16460591)
 * Thanks for the report. This change doesn’t really make sense so I think it might
   be a red herring.
    - Which theme are you using?
    - Does the problem still exist if you switch to one of the default themes such
      as Twenty Twenty One?
    - Do you have any plugins active that disable jQuery or load it from elsewhere?
    - Do you have any plugins active that change the order that JavaScript or CSS
      files are loaded or try to “optimise” or disable them?
 *  Thread Starter [DaveWP196](https://wordpress.org/support/users/davewp196/)
 * (@davewp196)
 * [3 years, 4 months ago](https://wordpress.org/support/topic/not-working-scripting-issue/#post-16461686)
    1. It is my custom theme. I do use a number of jQuery libraries (including accordion,
       contextMenu, UI, slickgrid).
    2. I have checked at original logic does work with the Twenty Twenty One Theme.
    3. Placing a breakpoint on line 56 and looking at the DOM environment, I can see
       that the query-monitor-main block has not been loaded, but it is loaded when
       the window.load event is triggered. As the Query Monitor HTML code is served
       after the </html> statement, I’m not sure of the logic used to move the block
       into the DOM either at bottom of the page or into the dashboard area at the 
       top of the screen. Is this a CSS defined movement?
    4. This said, the change I have proposed does ensure the code on lines 51 and after
       line 56 does not run until the page has finished loading into the DOM and any
       associated CSS changes have completed.
 * BTW – I’m using Bing on windows 11
    -  This reply was modified 3 years, 4 months ago by [DaveWP196](https://wordpress.org/support/users/davewp196/).
    -  This reply was modified 3 years, 4 months ago by [DaveWP196](https://wordpress.org/support/users/davewp196/).

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

The topic ‘Not Working – scripting issue’ is closed to new replies.

 * ![](https://ps.w.org/query-monitor/assets/icon.svg?rev=2994095)
 * [Query Monitor](https://wordpress.org/plugins/query-monitor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/query-monitor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/query-monitor/)
 * [Active Topics](https://wordpress.org/support/plugin/query-monitor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/query-monitor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/query-monitor/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [DaveWP196](https://wordpress.org/support/users/davewp196/)
 * Last activity: [3 years, 4 months ago](https://wordpress.org/support/topic/not-working-scripting-issue/#post-16461686)
 * Status: not resolved