Bug Tracker

Opened 11 years ago

Closed 11 years ago

#10778 closed bug (invalid)

$form.submit() behaving differently between chrome and firefox

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: event Version:
Keywords: Cc:
Blocked by: Blocking:

Description

Consider the following:

var $form = $('<form id="fid" action="/page.php" method="post" target="iframe_name" ><input type="hidden" name="title" value="7" /></form>');

var $iframe = $('<iframe  name="iframe_name" ></iframe>');
$('body').prepend($iframe);
$form.submit();

the last line will cause page.php to load in chrome but not in firefox. in firefox it will work if i write $('body').prepend($form); before the submit() command versions: CHROME: 15.0.874.106 m FIREFOX: 7.0.1

this is my first bug report here. hope i'm not spamming you

Change History (3)

comment:1 Changed 11 years ago by dmethvin

Owner: set to [email protected]
Status: newpending

Please post a link to a complete but minimal page that represents a test case, so we don't misinterpret your code snippet. We prefer that people use jsFiddle.net for test cases.

While you're creating a test case, please do the equivalent in bare DOM functions, I suspect the problem may be the browser and not jQuery. For example, your form is not attached to the document and that may not be something that Firefox supports. If the problem occurs in Firefox with only DOM functions and no jQuery, you should file a bug with them.

comment:2 Changed 11 years ago by [email protected]

Status: pendingnew

Hi. Here's a jfiddle : http://jsfiddle.net/Q6DaZ/4/ . (behaves differently in brosers: firefox and IE are not like chrome ) You're right, its not a bug with jquery. I'll post this to mozilla or something... I was wondering, however, whether it made more sense to fail to post the form in all browsers or cheat firefox so that it behaves the same for all browsers. It would have saved me time debugging on firefox. maybe it can save others time. (though this is probably isn't a big deal since most forms are on the page to begin with)

Thanks,

Shimon

comment:3 Changed 11 years ago by timmywil

Component: unfiledevent
Priority: undecidedlow
Resolution: invalid
Status: newclosed

I'd recommend attaching the form before submitting. You can make it hidden if necessary. Thanks for looking into this further.

Note: See TracTickets for help on using tickets.