Wordpress: Lightbox JavaScript conflict

  • Ryan
    Asked on May 8, 2018 at 10:25 AM

    The lightbox code that I got from my Jotform's PUBLISH section causes my page to produce a ton of errors in the Chrome Devtools Console. Upon removing the code, all the errors disappear.

    I want the lightbox to appear the way it does right now without causing any errors. Additionally because of those errors, clicking on any tab of the AMENITIES section causes the page to snap back to the top. How can I fix this???

    The lightbox code is:

    <script src ="https://form.jotform.com/static/feedback2.js" type="text/javascript"></script>

    <script type="text/javascript">

        var JFL_80654918596169 = new JotformFeedback({

            formId: '80654918596169',

            base: 'https://form.jotform.com/',

            windowTitle: 'Want to request a tour?',

            background: '#eb8022',

            fontColor: '#FFFFFF',

            type: '0',

            height: 400,

            width: 350,

            openOnLoad: true

        });

    </script>


  • aubreybourke
    Replied on May 8, 2018 at 12:09 PM

    The problem here is that there is a conflict with your JavaScript libraries. The lightbox and other scripts on your WordPress site are clashing. 

    One possible solution is to add:

    wp_enqueue_script("jquery");

    to your functions.php file.


    As suggested here:

    https://digwp.com/2011/09/using-instead-of-jquery-in-wordpress/