--- title: "Custom JavaScript" slug: "custom-javascript" description: "Extend your Document360 knowledge base with custom JavaScript to add dynamic behavior, integrate tools, and enhance user experience across all pages." updated: 2026-07-24T10:11:18Z published: 2026-07-24T10:11:18Z canonical: "docs.document360.com/custom-javascript" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.document360.com/llms.txt > Use this file to discover all available pages before exploring further. # Custom JavaScript Custom JavaScript in Document360 lets you add your own JavaScript code to extend the functionality of your knowledge base site beyond what the built-in settings provide. You paste code directly into the portal and it runs on every page of your knowledge base site. This is the right tool when you need to add dynamic behavior, interact with page elements, integrate third-party scripts, or automate interactions that cannot be configured through the standard settings. --- ## When to use custom JavaScript Use custom JavaScript when you need behavior or functionality that CSS and the built-in settings cannot provide: - **Modify page structure dynamically** - reorder, show, or hide elements on the page based on conditions. For example, move the related articles section above the feedback section, or hide the left navigation bar for specific readers. - **Add header interactivity** - append social media icons, dynamic feedback links, or custom buttons to the navigation header using JavaScript. - **Integrate third-party tools** - embed analytics scripts, chat widgets, feedback tools, or custom tracking that need to run on every page. - **Show only the active category in the left sidebar** - filter the category tree so only the currently active category and its sub-categories are visible, reducing navigation clutter for readers. --- ## Before you begin - You must have a user account with admin-level access to the Knowledge base portal. - Custom JavaScript applies globally to the entire knowledge base site - it runs on every page and affects all readers. - Document360 does not validate or lint your JavaScript code. - Errors will not be flagged automatically and broken scripts can disrupt the site experience. Test your changes carefully before saving. NOTE Document360's knowledge base site uses a Single Page Application (SPA) model. This means only the article content refreshes when a reader navigates - not the full page. Custom JavaScript that relies on page-load or page-refresh events may not work as expected. Use the `articleload` event instead: ``` panel.addEventListener('articleload', function() { // Your custom JavaScript code here }); ``` --- ## How to add custom JavaScript 1. Navigate to **Settings** () > **Knowledge base site** in the left navigation bar of the Knowledge base portal. 2. In the left navigation pane, navigate to **Site customization**.  1. Click **Custom CSS & JavaScript**. 2. Select the **JavaScript** tab. The JavaScript code editor appears. 3. Paste your JavaScript code in the text area. 4. Click **Save** to apply your changes.  The JavaScript is now active on your knowledge base site. Visit the site to verify the behavior. --- ## Use case examples The following examples show common customizations you can achieve with custom JavaScript. ### Move related articles above the feedback section ``` panel.onload = function () { $(".content_block_text").append("