$("form#photo-upload-form")
.submit(function() {alert("inside");})
.submit();
Of course, if you just wanted the form to autosubmit, just remove your function from inside the first .submit() call and it will submit the form. In the form above it will allow you to run some arbitrary code before the submission.
I also changed your query from the xpath to the ID of the form tag. Why not use it since it was already there.
On 10/18/06, Marshall Salinger < [EMAIL PROTECTED]> wrote:
I also changed your query from the xpath to the ID of the form tag. Why not use it since it was already there.
On 10/18/06, Marshall Salinger < [EMAIL PROTECTED]> wrote:
Hello,
This is my first post to the list. I am still new to jQuery and so far I think it is the best lib available. You guys rock!
Anyways, I have a question regarding a form I am trying to submit using jQuery. I was using an inline onchange event to trigger the form submit for an file input box.
Here is the html and js:
$(document).ready(function() {$("#file").change(function() {alert("change");uploadPhoto();});});var uploadPhoto = function() {$("/html/body/div/form").submit(function() {alert("inside");});}<form name="photo" id="photo-upload-form" action= "/" method="get" enctype="multipart/form-data"><div><label for="image">Find Your Photo</ label><input id="file" type="file" name="image" /></div></form>
I can get an alert to fire inside the uploadPhoto function, but not inside the submit function. I was worried that I wasn't targeting the form correctly, so I used firebug to find the XPath to it. I am not sure why it isn't working.
Thanks,
Marshall
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
</IRS> - fairtax.org
_______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
