Submit html form on dropdown menu value selection or change using javascript


If you have a Html (or Html5, JSP, PHP, ASP) page with a form element containing select option and you want to submit the form once a option is selected from the list of the dropdown then you can make use of javaScript.

Let's see how we can do that with an example, We have a text input type and a dropdown option with select options as : add, delete, and update. The user would enter a name and select one of the option to submit the form. We have no buttons. We do this using javaScript onchange event and submitting the form using this.form.submit()

File: dropdownexample.html
<html>
<head>
<title>Submit form on Dropdown list select</title>
</head>

<body>
<form method="get">

Name : <input type="text" id="name" name="name" />
<br /><br />

Option : 

<select onchange="this.form.submit()" id="option" name="option">
	<option>Select Option</option>
	<option>Add</option>
	<option>Delete</option>
	<option>Update</option>
</select>
</form>
</body>
</html>