How about something like this (completely untested):

function changeSelects() {
    $(".selectsubmit").each(function(){
        // search for submit button and remove him // 
           $('[EMAIL PROTECTED]"submit"]', this.form).remove(); 
        console.log( $(this).parent().attr('name') );

        // set onchange event handler for select //
        $(this).change(function(){
            // submit form //
               this.form.submit();
        });
    });
}


Every form element has a property called "form", which is a reference to the form element they are contained in.

         $(this).parent().submit();  // why does not work when i get
right console.log output of the form name ?

The reason for that, IIRC, is that $("foo").submit() (and others like it -- click(), etc), triggers a "fake" submit event. All of the "submit" event handlers are fired as if a form submission had actually occured, but the submit method on your form element is never actually called (although I believe there was talk of adding this in).
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to