Dynamically setting <img> data representing an SVG image
-
Hi, What is the best method (if any) to set the picture of an tag using some text string representing an SVG image? That is, I don't want to change the 'src' attribute to point to another file, but to set the actual data somehow... I saw something like  which does not seem to work. Maybe I'm supposed to parse/load the file using some Javascript function? Thanks in advance! /Erik
-
Hi, What is the best method (if any) to set the picture of an tag using some text string representing an SVG image? That is, I don't want to change the 'src' attribute to point to another file, but to set the actual data somehow... I saw something like  which does not seem to work. Maybe I'm supposed to parse/load the file using some Javascript function? Thanks in advance! /Erik
Erik Hammar wrote:
Maybe I'm supposed to parse/load the file using some Javascript function?
Maybe as a "Developer" you are supposed to find and "Read" Documentation[^] Having a clear understanding of fundamental concepts is key to being a capable developer.
led mike