Thanks Klaus and Paul,

I was getting errors on the empty submit call. It works now. 

Thanks!
-Marshall


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Klaus Hartl
Sent: Wednesday, October 18, 2006 8:41 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Submitting a form after input type="file" onchange


> $("form#photo-upload-form")
>     .submit(function() {alert("inside");})
>     .submit();

That won't work. You have to get out the DOM node out of the jQuery 
object first before calling submit() on it:

$("#photo-upload-form")
     .submit(function() {alert("inside");})
     [0].submit();
     ^^^

You have to be always careful with such code. Once the element 
#photo-upload-form is not found for whatever reason an error will be 
thrown, because yor are calling a function on undefined.

Speaking of optimizing queries, leave away the element type "form" in 
front of your id selector as well.


-- Klaus

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to