Changing tag name, from <div> to <canvas>?

A

Andre

Hi-

Is it possible to dynamically change a tag name, say a <div> into a
<canvas>? The reason I want to do this is that I would like my page
to validate (according to htmlTidy) but the <canvas> tag is flagged as
an error.

I have tried something like:

var canvasName = document.getElementById("canvas_%s");
canvasName.tagName="p";

but got an error about setting a property that has only a getter...

André
 
A

Andre

Hi-

Is it possible to dynamically change a tag name, say a <div> into a
<canvas>? The reason I want to do this is that I would like my page
to validate (according to htmlTidy) but the <canvas> tag is flagged as
an error.

I have tried something like:

var canvasName = document.getElementById("canvas_%s");
canvasName.tagName="p";

but got an error about setting a property that has only a getter...

André
ok, I found an alternative solution: I dynamically create a canvas as
a child of the div and manipulate it afterwards...
 
A

Andre

Yep... that's really the only solution. I think your original proposal was
something along the lines of "how do I turn my airplane into a boat?"

Well, I've been using Python as a server, fetching web pages, changing
dynamically the content, before feeding them back to the browser. So,
I have been "turning airplanes into boats" behind the scene. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top