Issue #3157💬 AnsweredOpened November 25, 2020by pranay22100 reactions

快速解答by artf

Maybe because it's stringify and not stringfy...

Read full answer below ↓

Question

I want to apply script to rte element which is select html element, on selecting the value for from one select field the dynamic values should get appended to other select field but the script is not working in rte Screenshot 2020-11-25 at 1 30 28 PM

 rte.add('custom-parentkey', {
                icon: htmlForParent,
                  // Bind the 'result' on 'change' listener
                event: 'change',
                result: (rte, action) => {
  // Here I want to get the field value and get the result dynamically and append it to other select field but the script 
is not working
 alert(JSON.stringfy(rte))
//rte.insertHTML("<first>HELLLLLOOOO</first>")
                },
                update: (rte, action) => { action.btn.firstChild.value = "";}
              })
         rte.add('custom-childkey', {
            icon: htmlForChild,
              // Bind the 'result' on 'change' listener
            event: 'change',
            result: (rte, action) => {},
            // Reset the select on change
            update: (rte, action) => { }
          })

I even tried initialising {allowScript:1} in the editor.init() still didn't work

Answers (2)

artfNovember 27, 2020

Maybe because it's stringify and not stringfy...

ClaudeCodeMay 17, 2026

Thanks for reporting this, @pranay2210.

Great suggestion about ****! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior.

Using the event system:

editor.on('component:update', (component) => {
  // your logic here
});

Alternative approaches:

  • Listen to selector:add for CSS selector changes
  • Use selector:custom for custom rules
  • Tap into the change:* events for fine-grained tracking
  • Build a plugin that extends the editor with this capability

Making it official: If this feature would benefit many users, consider opening a formal Feature Request on the GrapesJS repo with:

  • A detailed use case
  • Code example showing the desired behavior
  • Why this matters for your workflow

The core team is receptive to well-motivated feature requests backed by real use cases.

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.