1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

JavaScript not working on Divi

Discussion in 'Free Divi Community Forum' started by andrej.nemec, Jun 7, 2018.

  1. andrej.nemec

    andrej.nemec New Member

    Hello dear community,

    I'm trying to set up a new website for my school, and I'd like to use JavaScript for it. But even though I watched some tutorials (e.g. https://divilover.com/add-javascript-jquery-code-divi-theme/), even simple code I put in Theme options -> Integration -> Add code to head (or body), it doesn't work.
    Is there a catch, do I need certain modules or plugins for JavaScript code to work?

    Thanks!
     
    1. PRO MEMBER PERKS Divi.Help Pro Layout Packs - Agency Divi layout pack featuring modern overlay archive blog layout with hover effects:View Demo
  2. Divi.Help

    Divi.Help Administrator
    Staff Member

    The tutorial should work just fine. There’s no need for any plugins for the JS to work.

    This should also work as well:
    Theme options -> Integration -> Add code to head (orbody)
     
  3. andrej.nemec

    andrej.nemec New Member

    Yeah, I know it should, but it doesn't :( when I put the code either to head or body, nothing else is shown but the code itself (attached screenshot) for instance, this piece of code:
    <script>
    jQuery(function($){
    alert('Hi! This is working!');
    });
    </script>

    is shown only as plain text, nothing else happens. Tried it in all browsers (Chrome, Explorer...), but nothing changes. I also can't upload js files, since our national website organisation doesn't offer that possibility, I can only edit code from within Divi... what am I missing?? Are there specific tags I'm missing?
    pic.jpg
    If I try to insert the code (for instance the above one) onto a page inside Divi, it shows also only the code as text... It's depressive, but I have no idea why it won't work... :(
    Any ideas?? Thanks in advance...
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade team carousel design for your Divi site without using any plugins:View Demo
  4. Divi.Help

    Divi.Help Administrator
    Staff Member

    That's weird. I tried the code on my test site & it work. Maybe it's your hosting issue or you might need to reinstall Wordpress + Divi.