How to find a Javascript error.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #9999797
    Support
    Keymaster

    When buttons, sliders, menus, or animations on your template stop working, a JavaScript error is almost always the cause. The fastest way to find it is to open your browser’s built-in developer console — it logs every error in real time as the page loads.


    Opening the Browser Console

    The console is part of your browser’s built-in developer tools. It shows all JavaScript errors, warnings, and messages the moment the page loads.

    Google Chrome and Microsoft Edge

    Both browsers share the same DevTools interface (Edge is Chromium-based, so they work identically).

    Option A — Keyboard shortcut (fastest)

    Press F12 on Windows/Linux, or Cmd + Option + I on Mac. Then click the Console tab if it’s not already selected.

    Option B — Right-click menu

    Right-click anywhere on the page → click Inspect → click the Console tab.

    Option C — Browser menu

    Click the ⋮ menu in the top-right corner → More toolsDeveloper toolsConsole tab.

    You’ll see a panel like this — errors appear in red:

    Chrome DevTools Console tab showing JavaScript errors in red with file and line references

    Mozilla Firefox

    Option A — Keyboard shortcut

    Press F12, or Cmd + Option + I on Mac. Click the Console tab.

    Option B — Right-click menu

    Right-click on the page → InspectConsole tab.

    Firefox Developer Tools Console tab in dark mode showing JavaScript errors

    Apple Safari

    Safari requires enabling the developer menu once before you can use it.

    Step 1 — Enable developer tools

    Go to Safari → Settings → Advanced and check “Show features for web developers” (called “Show Develop menu in menu bar” on older versions).

    Step 2 — Open the console

    Press Cmd + Option + C, or go to Develop → Show JavaScript Console.


    How to Read an Error Message

    Every console error follows the same structure. Once you know how to read it, you can immediately tell what went wrong and where.

    Diagram breaking down the parts of a JavaScript error: Uncaught, error type, message, and file:line

    • Uncaught — The error was not handled by any try/catch block in the code.
    • Error type — The category: ReferenceError, TypeError, SyntaxError, etc. Each type points to a different kind of problem.
    • Message — A plain-English description of what went wrong (e.g. $ is not defined, Cannot read properties of null).
    • File & line — The blue clickable link (e.g. theme.js:441). Click it to open that exact line in the Sources/Debugger tab.

    Important: If you see multiple errors, focus on the first one. Later errors are often caused by the first failure cascading through the page.


    Common JavaScript Errors and Fixes

    “$ is not defined” or “jQuery is not defined”

    This is the most frequent error on HTML templates. It means jQuery is not loaded, or it’s being loaded after the scripts that depend on it.

    Fix: Make sure jQuery loads first, before any other scripts in your HTML:

    <!-- jQuery must come FIRST -->
    <script src="js/jquery.min.js"></script>
    
    <!-- Then your other scripts -->
    <script src="js/plugins.min.js"></script>
    <script src="js/theme.js"></script>

    Also verify that the path to jquery.min.js is correct and the file actually exists on your server. If you’re loading jQuery from a CDN, check your internet connection and confirm the CDN URL hasn’t changed.

    “Cannot read properties of null” or “Cannot read properties of undefined”

    A script is trying to access an element (a button, div, or other HTML element) that doesn’t exist on the current page, or the script is running before the page has finished loading.

    Fix: Move your <script> tags to the bottom of <body>, just before </body>, rather than in <head>. This ensures all HTML elements are ready before scripts run. Alternatively, wrap your code in a DOM ready listener:

    document.addEventListener('DOMContentLoaded', function() {
        // your code here runs after the page is ready
    });

    “X is not a function”

    Something your code is treating as a function is actually null, undefined, or a different type. Common causes: a plugin isn’t loaded, it’s loaded in the wrong order, or there’s a naming conflict between two libraries.

    Fix: Click the blue file:line link in the error to see exactly where the call is happening. Confirm the library or plugin that provides the function is included in your HTML and loads before the script that calls it.

    “Failed to load resource” or “net::ERR_ABORTED 404”

    A JavaScript or CSS file referenced in your HTML cannot be found on the server. Any functionality provided by that file will be broken.

    Fix:

    • Open the Network tab in DevTools (next to Console)
    • Reload the page — files that failed to load appear in red
    • Check the exact path in the error and compare it to what’s in your HTML
    • Confirm the file was uploaded to the server and is in the correct folder

    “Uncaught SyntaxError”

    There is invalid JavaScript in one of your files — a typo, missing parenthesis, or an edit that broke the syntax.

    Fix: Click the file:line link to see the exact line. If you recently edited that file, undo your changes. If you haven’t touched it, try re-uploading the original file from your purchase.


    Tips and Tricks

    • Hard refresh — A regular F5 reload can serve cached (old) scripts. Force a full reload with Ctrl + Shift + R on Windows/Linux, or Cmd + Shift + R on Mac. This clears the cache and re-downloads all files.
    • Try incognito / private mode — Browser extensions (ad blockers, script blockers, dev tools) can inject scripts or block resources and cause errors that aren’t actually in your template. Test in an incognito window to rule this out.
    • Test in another browser — If the error only appears in one browser, it may be a browser-specific compatibility issue rather than a template bug.
    • Check the Network tab for 404s — Switch to the Network tab, reload the page, and look for red rows. These are files that failed to load and are likely causing your errors.
    • Right-click → Copy message — Right-click any console error to copy the full message. Paste it into a Google search — most errors have widely documented solutions.
    • Focus on line 1 first — The console lists errors in the order they occur. The first error is usually the root cause. Fix it and reload — subsequent errors often disappear on their own.

    Contacting Support

    If you can’t resolve the issue on your own, we’re happy to help. To speed up the diagnosis, please include the following in your support request:

    • The full error message exactly as it appears in the console (copy-paste, not a paraphrase)
    • The URL of the page where the error occurs
    • Your browser name and version (e.g. Chrome 125, Firefox 127)
    • A screenshot of the Console tab showing the error in context
    • Whether the issue occurs in all browsers or only one
    • Any recent changes you made (file edits, plugin additions, hosting moves)

Viewing 1 post (of 1 total)

This topic is marked as "RESOLVED" and can not rceive new replies.