tag to my block. It works fine when I drag the block for the first time but when I store and reload the page (so i load what i stored in db) I'm having a JSON error.. Here is my code : Here is my error : More info : I did add the allowScripts: true line and It seems to come...","answerCount":2,"author":{"@type":"Person","name":"ThomasLaigneau","url":"https://gjs.market/go?url=https%3A%2F%2Fgithub.com%2FThomasLaigneau"},"dateCreated":"2018-11-27T15:42:00Z","dateModified":"2019-12-02T19:37:59Z","acceptedAnswer":{"@type":"Answer","text":"https://stackoverflow.com/questions/28259389/how-to-put-script-in-a-javascript-string","dateCreated":"2018-11-30T17:22:19Z","upvoteCount":0,"author":{"@type":"Person","name":"artf","url":"https://gjs.market/go?url=https%3A%2F%2Fgithub.com%2Fartf"},"url":"https://gjs.market/issues/1611-script-tag-create-json-error#answer-443275814","sameAs":"https://github.com/GrapesJS/grapesjs/issues/1611#issuecomment-443275814"},"suggestedAnswer":[{"@type":"Answer","text":"Sorry, I tried to follow the tips in the stackoverflow post but nothing works.. still got that error even if I escaped the / from the tag","dateCreated":"2018-12-02T19:15:36Z","upvoteCount":0,"author":{"@type":"Person","name":"ThomasLaigneau","url":"https://gjs.market/go?url=https%3A%2F%2Fgithub.com%2FThomasLaigneau"},"url":"https://gjs.market/issues/1611-script-tag-create-json-error#answer-443533889","sameAs":"https://github.com/GrapesJS/grapesjs/issues/1611#issuecomment-443533889"}]}}
Issue #1611💬 AnsweredOpened November 27, 2018by ThomasLaigneau0 reactions

Script tag create JSON error

Quick answerby artf

https://stackoverflow.com/questions/28259389/how-to-put-script-in-a-javascript-string

Read full answer below ↓

Question

Hi. I'm creating blocks in Grapesjs and I need to use JS on them for hover effect and more.. Everything works fine for the creation, store, load and the style of each blocks. I have a problem when I add the <script></script> tag to my block. It works fine when I drag the block for the first time but when I store and reload the page (so i load what i stored in db) I'm having a JSON error.. Here is my code : Here is my error : More info : I did add the allowScripts: true line and It seems to come from the gjs_components content that i stored in db.. Thanks for help..

Answers (3)

ThomasLaigneauDecember 2, 2018

Sorry, I tried to follow the tips in the stackoverflow post but nothing works.. still got that error even if I escaped the / from the </script> tag

lock[bot]December 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

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.