Skip to main content

Bug Tracker

Side navigation

#10778 closed bug (invalid)

Opened November 13, 2011 05:15PM UTC

Closed November 13, 2011 07:45PM UTC

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

Reported by: s.shpiz@gmail.com Owned by: s.shpiz@gmail.com
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

Attachments (0)
Change History (3)

Changed November 13, 2011 05:58PM UTC by dmethvin comment:1

owner: → s.shpiz@gmail.com
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.

Changed November 13, 2011 07:38PM UTC by s.shpiz@gmail.com comment:2

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

Changed November 13, 2011 07:45PM UTC by timmywil comment:3

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.