Issue #3730💬 AnsweredOpened August 27, 2021by hrdkzala0 reactions

Script tag not rendering in HTML page

快速解答by artf

Sorry but I don't understand where is your issue. You have created comp-with-js component but then you don't show where you are using it... Please, provide a reproducible demo.

Read full answer below ↓

Question

I created the component as below.

const script = function() {
        const script = document.createElement('script');
        script.src = 'http://localhost:8888/builder/sites/site1/assets/js/jquery-1.12.4.min.js';
        document.body.appendChild(script);
});
editor.Components.addType('comp-with-js', {
      model: {
        defaults: {
          script
        }
      }
    });
editor.BlockManager.add('site_1', {
      label: 'Template 1',
      category: 'Template',
      content: '<div> HERE is my content </div>'
});

site_1 - is my readymade template and it has CSS and javascript.

CSS loads properly with the "content" but javascript doesn't so I created component for javascript.

On the HTML page, It shows the jquery file is added but doesn't work. I checked in view source.

If I made any external javascript file which simply alert("test"), but it doesn't work on html page.

I am using NuxtJS + Grapesjs.

Please advise me about this issue.

Answers (4)

artfAugust 29, 2021

Sorry but I don't understand where is your issue. You have created comp-with-js component but then you don't show where you are using it... Please, provide a reproducible demo.

mingxin-yangSeptember 3, 2021

script function don't work after drag the block @artf

ClaudeCodeMay 17, 2026

Thanks for reporting this, @hrdkzala.

Thanks for sharing your report about Script tag not rendering in HTML page. To help the team investigate and prioritize this:

Please provide:

  1. A minimal reproducible example (CodeSandbox/JSFiddle)
  2. Your GrapesJS version number
  3. Browser and OS information
  4. Any error messages from the browser console
  5. Steps to reproduce the issue

What helps most:

  • Minimal code example (not your full project)
  • Screen recording or screenshot showing the issue
  • Expected vs actual behavior clearly stated
  • GrapesJS configuration you're using

With these details, the maintainers can identify and prioritize a fix much faster. The GrapesJS team is very responsive to well-documented issues.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.