Form tags stripped out in FF with innerHTML

G

geed_dd

Hi

I have a piece of code which replaces the contents of a div using
innerHTML

e.g. this.targetDiv.innerHTML = '<form name="test" id="test1"> in form
</form>';

This works fine in IE but FF(1.5.04) strips out the <form> and </form>
tags.

I know there are some differences in how these browsers handle
innerHTML but I can't seem to find anything on this specific problem.

Does anyone have any idea why this is happening?

Thanks.

G
 
M

Martin Honnen

geed_dd said:
I have a piece of code which replaces the contents of a div using
innerHTML

e.g. this.targetDiv.innerHTML = '<form name="test" id="test1"> in form
</form>';

This works fine in IE but FF(1.5.04) strips out the <form> and </form>
tags.

Is there already a form element as an ancestor of the target div?
What does DOM inspector show?
 
G

geed_dd

Thanks for the quick reply and advice.

There is a misplaced form element ancestor. I should have spotted this
as I've come up across this before.
 

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

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top