• Resolved Anthony Valentine

    (@npoutdoors)


    I can’t get rid of this JS error in my console log.

    It goes away when I disable the JS Options.

    I’ve tried all the advanced JS options that mention potentially fixing JS errors.

    The error usually is:

    (index):16 Uncaught ReferenceError: Dropzone is not defined
    at (index):16
    (anonymous) @ (index):16
    autoptimize_a05b472bf2f9d46d4bb39158056fd927.js:2 JQMIGRATE: Migrate is installed, version 1.4.1

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Have you tried adding plugins/cooked-pro/modules/dropzone/dropzone.min.js to the comma-separated list of JS optimization exclusions?

    frank

    Thread Starter Anthony Valentine

    (@npoutdoors)

    You’re a life saver.

    I was so close to trying something like that. Very new to all of this.

    My site in google insights was a 10/100 yesterday on mobile and now is a 98 so I’m very happy with the improvements.

    Thanks, that worked.

    Anthony

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome npoutdoors, feel free to leave a review of the plugin and support here! ??

    frank

    Thread Starter Anthony Valentine

    (@npoutdoors)

    Left a review.

    While I have you. Can you figure out why this accordion isn’t working? I feel like it’s the same issue I just don’t now how to find the issue.

    It’s saying “Unexpected token <”

    Page: https://www.cukebook.org/guides/herbs-and-spices/

    The accordion code works on my HTML websites but not the WP site.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    there are HTML tags in the inline accordion JS;

    var i;</p>
    <p>for (i = 0; i < acc.length; i++) {

    remove those </p> and <p> and all should be fine ??

    Thread Starter Anthony Valentine

    (@npoutdoors)

    The only script I have on that page is:

    <script>
    var acc = document.getElementsByClassName(“accordion”);
    var i;

    for (i = 0; i < acc.length; i++) {
    acc[i].addEventListener(“click”, function() {
    this.classList.toggle(“active”);
    var panel = this.nextElementSibling;
    if (panel.style.display === “block”) {
    panel.style.display = “none”;
    } else {
    panel.style.display = “block”;
    }
    });
    }
    </script>

    And there is no <p> is there. Is wordpress placing one there after I save?

    Should I not be putting the JS directly in the WP page? I have the Visual settings off and I’m working only in Text/HTML.

    I also tried adding this to the functions.php and had no result:

    function wpb_hook_javascript() {
    if (is_page (’10’)) {
    ?>
    <script type=”text/javascript”>
    // my script went here.
    </script>
    <?php
    }
    }
    add_action(‘wp_head’, ‘wpb_hook_javascript’);

    Thread Starter Anthony Valentine

    (@npoutdoors)

    I added:

    remove_filter( ‘the_content’, ‘wpautop’ );
    remove_filter( ‘the_excerpt’, ‘wpautop’ );

    To my functions.php and that did the trick…

    Thanks

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    removing the empty line between

    var i;

    for (i = 0; i < acc.length; i++) {

    would have also helped though ??

    Thread Starter Anthony Valentine

    (@npoutdoors)

    I tried that it didn’t work.

    It’s better after that…But not working fully. You click the accordion and it drops down and then there’s no content inside the panel.

    I’d rather not use:

    remove_filter( ‘the_content’, ‘wpautop’ );

    For the entire website.

    But it’s not the end of the world.

    Anthony

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I’d rather not use:

    remove_filter( ‘the_content’, ‘wpautop’ );

    For the entire website.

    well, I assume this is in a widget or a block; in that case make sure that that’s an HTML/ code widget/ block and not a text block, that _could_ make wpautop stop acting on the code.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘JS Error in Console’ is closed to new replies.