开发者

How to submit a form WITHOUT clicking a submit button?

I want the form to be submitted when 开发者_StackOverflowthe user chooses one of the radio button options. I know how to do this with select fields:

<select name='something' onchange="this.form.submit()">

But how to do this with radio buttons?


You can use onclick:

<input type="radio" name="something" onclick="this.form.submit()">

You can test for compatibility (of keyboard entry like left/right or tabbing then pressing space/enter and even keyboard only navigation plugins) using this example.


Try hooking into the onclick event.


<input type="radio" name="something" value="somethingvalue" onclick="this.form.submit();" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜