views:

11965

answers:

5

Hi,

I want to submit a with using jquery as below;

$("#formid").submit();

Its working perfect in all browsers except IE6.

How to make it work in IE6 ??

A: 

Should work - are you in quirks mode?

Rich Bradshaw
"Quirks mode" only affects rendering, not DOM
Sergey Ilinsky
+1  A: 

You could try $("#formid").trigger("submit"), though I doubt it'll give you a different result.

Ben Alpert
+29  A: 

You probably have an <input name="submit" /> somewhere in your form, which overwrites the function "submit" of the form in IE

I.devries
Yups. I have an input tag (button) name as "submit" and that was creating problem. Thanks!
Prashant
Wow nice catch. Was not aware of this.
Paolo Bergantino
I should have searched SO sooner! Thanks!
eyston
Wow, this saved me to.. In IE8...
rebellion
A: 

Don't forget to return false; if you're on an tag

+8  A: 

I had a similar problem when I was about to submit the form via an A-element. I had set the href attribute to "javascript:;" to let the main jQuery script handle the actual submit but it just wouldn't work in IE6.

jQuery main script:

$(".submitLink").click(function(){
$(this).parent()[0].submit();
$(this).addClass("loading");
});

My solution was to change the href attribute from "javascript:;" to "#".

Excellent, in my case I set the href to "javascript:void(0);". All events hooked into click() fired, but the form would not submit. Changing the href to "#" fixed it. Thanks!
Peter J
Same problem as Peter, fixed. Thanks a lot!
Marco Z
$(".submitLink").click(function(event){event.preventDefault(); // prevent browser from scrolling to top of page});
Chris Jacob