简体   繁体   中英

Can I use HTML tags inside an SVG tag?

I'd like to use regular HTML tags (for instance an input tag) within an SVG tag.

Why? I would like my SVG graphic to be able to get text from the user (eg, the user clicks on a box drawn with SVG and enters text on it), so I was thinkig about using HTML input tags within an SVG tag. Is this possible?

If the answer is no (which most probably will), how can I allow a user edit SVG text?

There is already an answer to that question:

how to change svg text tag using javascript innerHTML

But its not accepted.

It seems to be possible when you look at this example

http://starkravingfinkle.org/blog/wp-content/uploads/2007/07/foreignobject-text.svg

from this source:

http://ajaxian.com/archives/foreignobject-hey-youve-got-html-in-my-svg

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM