Issue #821💬 AnsweredOpened January 30, 2018by Deepak8130 reactions

How to set the href attribute

Quick answerby JulyanoF

@Deepak813 I guess that it isn't in model, it should be something like: editor.getSelected().set('href', 'https://www.facebook.com/sharer/sharer.php?u=') You don't need to access model

Read full answer below ↓

Question

Hi @artf, Please let us know how we can set the href attribute of anchor inside div when element is dragged i.e <div class="social_icons rrssb-buttons c3250"> <a href="https://www.facebook.com/sharer/sharer.php?u=http://starteo.softobiz.com" class="popup rrssb-facebook" id="ibvm"><i aria-hidden="true" class="facebookSocial fa fa-facebook"> </i></a> <a href="https://twitter.com/intent/tweet?text=https://rrssb.netlify.com/" class="popup rrssb-twitter" id="iuhg"><i aria-hidden="true" class="fa fa-twitter" id="iayz"> </i></a> <a href="mailto:?Subject=your%20subject" class="rrssb-email" id="i6ji">...

Answers (3)

JulyanoFJanuary 30, 2018

@Deepak813 I guess that it isn't in model, it should be something like: editor.getSelected().set('href', 'https://www.facebook.com/sharer/sharer.php?u=') You don't need to access model

Deepak813January 30, 2018

Hi @JulyanoF,

Thanks for the message,

I have used this code when element is dragged but display following error:

Uncaught TypeError: Cannot read property 'set' of null.

As i want to update the href of anchor tag inside the div when element is dragged.

JulyanoFJanuary 30, 2018

@Deepak813 Oh, you want to change anchor when is draggin/dropping?

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.