0

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

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Airshow
0

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>
0

Dasatti,

You could try hard-coding the <form ...></form> 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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.