Appending to nested components
Figured this out! Just had to specific an array position :-) After using component.find('fieldset') be sure to set an array position fieldSet[0].append(questionFieldSet);
Read full answer below βQuestion
I'm using component.find() to search for a nested component in a big chunk of HTML content for a fieldset tag so that I can append components after it. Component.find locates the component, as seen in the console.log, but attempting to .append or use .components to inject content results in a console error: fieldSet.append is not a function. The goal is to use Traits to inject a chunk of HTML using the variable questionFieldSet into the form after the first fieldset. If I use editor.getSelected().append, the HTML injects but at the wrong position as expected. I need to inject deeply within th...
Answers (1)
Figured this out! Just had to specific an array position :-)
After using component.find('fieldset') be sure to set an array position fieldSet[0].append(questionFieldSet);
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3352
Default Content is getting Inserted while using setComponents if Tag Body is empty
Version: Latest You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo?[X] Yes...
Issue #6152
CSS added via custom code persists after custom code component is removed
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? any Reproducible demo link https://grapesj...
Issue #4848
Component content is set to empty string after inline editing
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox v91.4.1 Reproducible demo link htt...
Issue #3579
RTE misplaced when opened right after dropping `activeOnRender` component
Version: 0.17.4 Are you able to reproduce the bug from the demo?[x] Yes[ ] No Steps to reproduce:Go to the demoDrop a "Text" block inside t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.