内联 onchange 提交不适用于 webkit(Chrome 或 Safari)

kyl*_*lex 0 javascript forms onchange

这可以在 FF 上提交,但不能在 Chrome 上提交。有什么建议么?

<form action="/test" method="post" onchange="this.submit();">
   <select>
      <option value="f">f</option>
      <option value="g">g</option>
   </select>
</form>
Run Code Online (Sandbox Code Playgroud)

Ibu*_*Ibu 5

<form action="/test" method="post" >
   <select name="select" onchange="this.form.submit();">
      <option value="f">f</option>
      <option value="g">g</option>
   </select>
</form>
Run Code Online (Sandbox Code Playgroud)

the onchange should be on the select tag. and it is a good idea to give it a name so you can retrieve the value on the server side.