Issue #634💬 AnsweredOpened December 13, 2017by HarshOB0 reactions

How can I pass content with script?

Quick answerby artf

change this components: "<h1>hello 123</h1>",

Read full answer below ↓

Question

I made custom component like this way and used script as well then script is working fine but I am not able to select component. Is there any other way to write content with script?

Answers (3)

artfDecember 13, 2017

change this components: "<h1>hello 123</h1>",

HarshOBDecember 14, 2017

I didn't get traits if I use script while creating a custom component. Is there any problem with traits?

artfDecember 14, 2017

well, there are no traits inside your block... If you're trying instead to use a custom component you have to set the type

content: {
        type: 'your-component-type',
        script: "console.log('the element', this)",
        content: "<h1>hello 123</h1>",

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.