Issue #2762πŸ’¬ AnsweredOpened May 9, 2020by lofcz0 reactions

How to listen to trait value change directly from block add

Quick answerby Aiyush-G

Did you solve this issue? If so, how?

Read full answer below ↓

Question

I'm passing following JSON to editor.BlockManager.add() function to define my block, load it's content from the server and populate select-type trait named defaultCategory in the same manner. Everything works nice. Now I need to listen to onchange event of that select and execute some JS there. I've consulted https://grapesjs.com/docs/modules/Traits.html#add-traits-to-components but can't fugure out how to do this. Would you mind to quickly show how would I execute alert('test') when value of my trait is changed (by user selecting one of the options)? Thanks in advance. For the button there i...

Answers (3)

Aiyush-Gβ€’ June 22, 2020

Did you solve this issue? If so, how?

SwapnilSoni1999β€’ August 22, 2023

guide please

Vampire-Vβ€’ September 28, 2023

@lofcz How do you fix this problem?

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 β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.