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)
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")
@Deepak813 as already mentioned by Ryan you have to use editor.getSelected().set('src',image_Url)
@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.
Issue #582
background image issue
Hi @artf one more issue when using custom manager , what do we set on background images? editor.getSelected().set('src', url) not working o...
Issue #740
How to remove class from html
Hi @artf, We are updating the <i> tag class but it adds new class to this but previous class is not remove.please let us know how to remove...
Issue #842
How we can set array using editor.getSelected().set('attributes',array value)
Hi @artf, How we can set array values using editor.getSelected().set('attributes',array value); If we try to do so with the same code then...
Issue #1061
How we can show countdown traits
Hi artf, Please let us know how we get the countdown elements in edit mode means when we set the template html using editor.setComponents(t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.