Issue #771Opened January 17, 2018by Deepak8130 reactions

Image src is not updating

Question

Hi @artf,

I have updated the image src using below code: editor.getSelected().set('attributes', {'src': image_Url});

but when i set all the html using below code: editor.setComponents(templateHTML); then image src not updating in HTMLcomponent.

Please let us know about the same.

Answers (3)

ryandebaJanuary 18, 20180 reactions

Hi @Deepak813,

I'm not sure where templateHTML is coming from in your example...is the src on your image set correctly in that variable?

In any case, selecting an image and running this code seems to work fine for me in the demo: editor.getSelected().set("src", "http://via.placeholder.com/350x150")

artfJanuary 18, 20180 reactions

@Deepak813 as already mentioned by Ryan you have to use editor.getSelected().set('src',image_Url)

AkibDeraiya123January 9, 20190 reactions

@ryandeba @artf Is there any possibilities to change other attributes of image like class, id etc? I had tried with like,

// For id
editor.getSelected().set('id',imageId)
// For class
editor.getSelected().set('class',imageClass)

But this seems not working in my case. Can you guys please help me how can i change other attributes of this image tag?

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.