Javascript select onchange='this.form.submit()'

前端 未结 6 1116
忘了有多久
忘了有多久 2020-12-01 05:42

I have a form with a select and a few text inputs. I\'d like the form to be submitted when the select is changed. This works fine using the following:

onchan         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 06:01

    Bind them using jQuery and make jQuery handle it: http://jsfiddle.net/ZmxpW/.

    $('select').change(function() {
        $(this).parents('form').submit();
    });
    

提交回复
热议问题