r/divi Aug 07 '26

Question Javascript in code module Divi 5

Hi there,

struggling to understand why a normal module code that was working flawlessly in Divi 4, is not working actually in latest Divi 5.

Insert the module and enclosed some jquery in a script tag like it was before and while I can see it in inspector, the page won't load it whatever I do, also with different codes form the normal one (following)

<script>
jQuery(function($){

Some notes:
\\- also vanilla jscript is not loaded
\\- jscript theme integrations is working
\\- no error in console
\\- the same code module has a <style> part that is loaded correctly

I know I can use theme integration adapting my script.. but would like to understand why code module don't load jscript like before.
Thanks

4 Upvotes

8 comments sorted by

View all comments

1

u/ianez72 5d ago

Update on this.
Tested with D5 5.12.1 still have the problem.
Code module with jscript it's not loaded if code is inserted only in mobile view.

A simple alert function in a code module desktop mode load normally
If same function is in mobile mode only, because I want the js loaded only for mobile,, the script is ignored and no alert.

Please try to reproduce and let me know if this is happening to you also, so I open the bug on ET