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

前端 未结 6 1111
忘了有多久
忘了有多久 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:07

    If you're using jQuery, it's as simple as this:

     $('#mySelect').change(function()
     {
         $('#myForm').submit();
     });
    

提交回复
热议问题