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>";


I am using Firefox version 3.6.16


Recommended Answers

All 2 Replies

Try it

<div id="some_div">&nbsp;</div>
	var str = '<form action="game.cfm" method="post"><input type="text" name="some_field"><input type="submit" value="Submit"></form>';


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.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.