jQuery form Ajax submit issue

Viewed 13

I have a div (#ajax-progress) containing multiple forms. I'm trying to get the div contents reloading when any of the forms are submitted. If I do this:

    $("#ajax-progress form").click(function(event){
        alert('something');

and click anywhere in one of the forms, it alerts correctly (so the selector seems correct). But! If I change it to submit:

    $("#ajax-progress form").submit(function(event){
        event.preventDefault();
        alert('something');

my jQuery seems to be ignored and the form submits normally. What am I missing?

Edit: I was thinking it might be something to do with this on some of my forms?

<input id="file-upload" type="file" onchange="this.form.submit();" name="file">

But I do need some of the forms submitting when a file is selected for upload. Could be a red herring anyway because other forms in the div that are just textarea and submit button exhibit the same behaviour.

0 Answers
Related