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/

Reply via email to