View Full Version : input tag without form? (error in IE)

02-26-2009, 04:53 PM

I have been using DOM to create two input tags, a text field and a button. I have been appending the input tags to a form. However, I actually have no need for a form because the button calls a javascript, and there is no submit action.

In fact, it is detrimental to be using a form because if a user hits enter in the textbox instead of using my button, it will try to submit the form, which is not what I want.

So, I instead changed my form to a div and tried appending input tags directly to the div. It works perfectly in firefox, but has an error in IE6 (haven't tried IE7). "Object doesn't support this property or method." Why can't I append an input to a div? How can I accomplish my goal without using a form?

For reference,


02-26-2009, 07:09 PM
why not simply add an onsubmit="return false" on the form?

02-26-2009, 07:51 PM
good call, thank you!