Cannot read property 'querySelector' of null - WordPress / Contact Form 7

Seem to be getting an error on our contact forms on version 5.4.1 and the version before using the Contact Form 7 plugin on WordPress. The error occurs when submitting the form regardless of entering information or not. The error which appears in console is as follows:

TypeError: Cannot read property 'querySelector' of null
at c (index.js?ver=5.4.1:1)
at Array.forEach (<anonymous>)
at index.js?ver=5.4.1:1

Read a couple of articles about rolling back to version 5.3.2 which I can confirm works and the issue isn't present in this version. Does anyone have a fix for it though? Or do we need to wait for another update? It's been a couple of weeks now since this was first found I believe.

If anyone needs any other information please let me know and I'll try to supply it.

Thanks!

1 answer

  • answered 2021-05-05 11:49 Jasper B

    This is due to a incompatability between your theme or a plugin with the new version of jquery used in wordpress. There are a few things you can do.

    • Update your theme and plugins and hope the JavaScript is patched by the author
    • Try to patch the broken code your self (this requires knowledge of javascript)
    • Install jQueryMigrate Plugin (this is only a Band-Aid and should not be the permanent solution)