954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Firefox stripping form tag in innerHTML

Hi,

I am generating a string from AJAX data which contains forms and submit buttons. I then try to assign this string to a div using innerHTML. This works fine in IE but Firefox strips form tags and every thing in between form tags. How to solve this issue

Example code:

str = "<form action='somepage.php' methid=post><input type=text name=some_field><input type=submit value='Submit'></form>";

document.getElementById('some_div').innerHTML=str;


I am using Firefox version 3.6.16

Thanks

dasatti
Junior Poster in Training
57 posts since Dec 2008
Reputation Points: 10
Solved Threads: 5
 

Try it

<div id="some_div">&nbsp;</div>
<script>
	var str = '<form action="game.cfm" method="post"><input type="text" name="some_field"><input type="submit" value="Submit"></form>';
	document.getElementById('some_div').innerHTML=str;
</script>
haleel
Newbie Poster
10 posts since Dec 2010
Reputation Points: 10
Solved Threads: 4
 

Dasatti,

You could try hard-coding the then deliver/insert just its contents.

If that doesn't work then hard code the whole form and show/hide it and change its properties/contents with DOM methods as necessary.

Airshow

Airshow
WiFi Lounge Lizard
Moderator
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: