Issue #1198💬 AnsweredOpened June 13, 2018by krunal0390 reactions

QUESTIONS : Find element in Model

Quick answerby artf

https://github.com/artf/grapesjs/issues/1157#issuecomment-397104559

Read full answer below ↓

Question

I have custom component and it render below html, I want to update value of h4 tilte and other element on trait changed, but not sure how can I find h4 and other element in model (NOT in view) and change value via trait change. I have used below approach but does not want to access model via index. updateTitle : function updateTitle() { var title = this.get('title'); var linkModel = this.get("components").at(0); if (linkModel) { var titleContainer = linkModel.get("components").at(3); if (titleContainer) { var h4 = titleContainer.get("components").at(0); if (h4) { h4.set("content", title); } }...

Answers (2)

lock[bot]September 17, 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.