Sign In : Sign Up : Blog : Search: Language : Help :
This website is now frozen, please migrate your content to BotLibre.com or BotLibre.biz
Java Script

How submit a form when a select (drop down) changes?

by jamesssss posted Aug 18 2014, 7:56

You can force an HTML form to submit whenever the value of a select (drop down/list) is changed with a little JavaScript.
To do this use the "onchange" event with the value "this.form.submit()"

<select name="my-select" onchange="this.form.submit()"> <option value="yellow">yellow</option> <option value="blue">blue</option> <option value="green">green</option> </select>

Try it out:

Id: 282203
Tags: submit, select
Posted: Aug 18 2014, 7:56
Updated: Mar 27 2015, 15:48
Replies: 0
Views: 1329, today: 1, week: 4, month: 10
I'm sure
Flag graphic as offensive, or in violation of site rules