Skip to content

HTML/JS: Insert Custom HTML and JavaScript Code

The HTML/JS element in ClickFunnels allows users to embed custom HTML and JavaScript code directly within a funnel page. This feature is designed for advanced users who want to add unique functionalities or styles that go beyond what standard ClickFunnels elements offer. In this article, you’ll learn how to properly add HTML and JavaScript code in the HTML/JS element to enhance your funnel pages.


  • An active ClickFunnels account

  • A page created in your workspace


Adding an HTML/JS Element in the Page Editor

Section titled “Adding an HTML/JS Element in the Page Editor”
  1. Inside the page editor, add a Section where you want to place the element.

  2. Add a Row within that section.

  3. Click the orange + Plus or Add New Element button inside the row to insert a new element.

  4. From the MISC (Miscellaneous) category, select the HTML/JS element.

Once the HTML/JS element is added, you can open the settings sidebar, select Open Code Editor, and enter your HTML and JavaScript code directly within the editor.


When you hover over an element, its border will be highlighted in orange. To access an element’s settings, click on the gear ⚙️ icon or click directly on the element.

Top Margin

The Top Margin setting lets you control the space between the current container (section, row, flex, and element) and the container directly above it. If no previous container exists, the margin will be applied relative to the parent container. If no preceding container is added, the Body will be the parent.

You can set top margin values independently for desktop and mobile by using the device icons (🖥️ & 📱 ). If no mobile value is specified, it will inherit the desktop setting by default. Use the slider or manually enter a value in pixels (px) or percentage (%) to create consistent spacing across screen sizes.

Open Code Editor

Clicking on Open Code Editor opens a text editor for adding custom HTML and JavaScript code. This editor supports both HTML and JavaScript code. Use the expand icon on the right side of the editor to enlarge it, and the X icon to close it. Your code is applied to the element when you close the editor. Refer to the Adding HTML Code and Adding JavaScript Code sections below to learn more about properly adding HTML and JavaScript code.
HTML / JS settings with the Open Code Editor button highlighted

Control Panel

The Control Panel appears at the bottom of every container(Section, Row, Flex, and Element) in the page editor, offering quick access to essential settings and actions for that container. Here’s what each icon represents:

  • ALL: The container will be visible on all devices (desktop, tablet, and mobile).

  • Desktop (🖥️) Icon: The container will only be visible in desktop view (screens 771px and wider).

  • Mobile (📱) Icon: The container will only be visible in mobile view (screens up to 770px wide).

  • Eye (👁️) Icon: Hides the container on all devices. It isn’t deleted. To show it again, select All, Desktop, or Mobile in this panel, or open Layout in the top bar and turn the container’s desktop or mobile toggle back on.

  • Code (</>): Opens the code editor for this container, where you can add custom CSS to change its styling. The editor shows the container’s CSS ID Selector so your CSS targets only this container. Open it from the code icon at the top of the settings panel, or hover over the container on the page and click Code in its toolbar.

  • Trash (🗑️) Icon: Removes the container from the page editor entirely.

Advanced Settings

To further customize your container (section, row, column, and element), ClickFunnels provides Advanced settings that allow you to control style, advanced CSS, animation, and rendering logic. We’ve separated these advanced features into dedicated articles to avoid overwhelming you with too much content in one place and to keep our documentation concise. Explore the following resources for more details:


To add HTML code within the Custom HTML/JS element:

  1. Open the Code Editor by clicking on Open Code Editor in the settings.

  2. Enter your HTML code directly into the editor.
    Code editor with an HTML example


The Custom HTML/JS element also supports JavaScript, allowing for interactive functionality or dynamic behavior.

To add JavaScript code:

  1. Open the Code Editor by clicking on Open Code Editor in the settings.

  2. Add your JavaScript code, enclosed in <script> </script> tags.
    Code editor with a JavaScript example inside script tags


The page editor doesn’t run your custom code. Instead, the element shows a CUSTOM JAVASCRIPT / HTML placeholder on the editor canvas. To see your HTML and JavaScript in action, preview or publish the page.


The code editor checks your code for HTML syntax errors (such as unclosed tags) as you type:

  • Error list: Any errors are listed below the code, each with its line and column number (for example, Line 3, Col 5) and a short description. Click an error to jump to that spot in the code.
    Code editor with an unclosed tag and the error list showing Line 4, Col 7

  • Red outline: If you close the code editor while the code still has errors, the element is outlined in red on the editor canvas.
    HTML/JS element outlined in red on the editor canvas because its code has errors

  • Error message: The page’s error list, which you can open from the warning icon in the top bar, shows Custom HTML/JS element contains syntax errors. Click to open editor. Click the message to reopen the code editor at the first error.

  • Save warning: When you save a page that has errors, a You have errors in your page window appears. Click Solve Errors to see the list of errors, or click Save Anyway to save the page without fixing them.


Merge tags in double curly braces, such as {{blog.url}} or {{course.url}}, are not replaced in your custom code by default. They appear on the page exactly as typed. To have ClickFunnels replace merge tags with their values, open the element’s Advanced settings and turn on Dynamically Populated. For more details, see Advanced Settings - Customize Styles.


If your code isn’t working as expected:

  • Check Console for Errors: Open your browser’s developer tools and review the console for error messages.

  • Review Code Structure: Ensure your HTML and JavaScript syntax is correct and doesn’t conflict with existing elements.

  • Consult a Developer: Consider consulting a professional developer for assistance with complex functionality.