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>
More Posts related to JavaScript,
- How to get UTC (GMT) time using JavaScript
- Submit html form on dropdown menu value selection or change using javascript
- How to detect Browser and Operating System Name and Version using JavaScript
- JavaScript : Get current page address
- [javaScript] Convert text case to lowercase
- How to check if a String contains substring or a word using javaScript
- Writing your first Hello, World! 🌍 JavaScript code Tutorial
- JavaScript: Check if variable is a number
- How to send email from JavaScript HTML using mailto
- Meaning of javascript:void(0) explained with example
- How to get query string in JavaScript HTML location.search
- Javascript convert text case from uppercase to lowercase
- Loading previous page using html button using JavaScript
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- How to get current URL Location using Javascript HTML
- Detect if Cookies are enabled using JavaScript
- Write javaScript code in Swedish using FikaScript
- Add Animated Scrolling to Html Page Title Script
- JavaScript: Convert an Image into Base64 String
- Remove items from JavaScript array
- Send Extra Data with Ajax Get or Post Request
- How to Print from JavaScript HTML using window.print
- Get Device Screen Width and Height using javaScript
- Examples: Convert String to int in JavaScript
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
More Posts:
- Git Rename master branch make to main using Command - Git
- Hide Navigation Bar from Android Screen Activity - Android
- say command macOS terminal examples - MacOS
- 10 FTP SFTP Clients and Alternatives - FTP
- SharePoint PowerShell PnP - How to get list item by Item ID using GetItemById, Get-PnPListItem - SharePoint
- Search text in Eclipse Console logs - Eclipse
- list of jars required for hibernate 4.x.x - Java
- How to upgrade PowerShell on Mac - Powershell