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,
- Meaning of javascript:void(0) explained with example
- JavaScript : Get url protocol HTTP, HTTPS, FILE or FTP
- How to get UTC (GMT) time using JavaScript
- Add Animated Scrolling to Html Page Title Script
- Examples: Convert String to int in JavaScript
- Get Device Screen Width and Height using javaScript
- Remove items from JavaScript array
- Javascript convert text case from uppercase to lowercase
- [javaScript] Convert text case to lowercase
- How to detect Browser and Operating System Name and Version using JavaScript
- How to send email from JavaScript HTML using mailto
- How to check if a String contains substring or a word using javaScript
- Send Extra Data with Ajax Get or Post Request
- How to get query string in JavaScript HTML location.search
- How to get current URL Location using Javascript HTML
- JavaScript: Check if variable is a number
- JavaScript : Get current page address
- JavaScript: Count Words in a String
- Loading previous page using html button using JavaScript
- npm WARN saveError ENOENT: no such file or directory, open /mnt/c/package.json
- How to Print from JavaScript HTML using window.print
- Submit html form on dropdown menu value selection or change using javascript
- Detect if Cookies are enabled using JavaScript
- Writing your first Hello, World! 🌍 JavaScript code Tutorial
- JavaScript date in yyyy-MM-dd format
More Posts:
- JavaScript : redirect page to other url - Android
- Launch Notepad++ html document in any web browser - NotepadPlusPlus
- Turn on off volume change button sounds Mac OS X - Mac-OS-X
- Comprehensive 256 Ascii code table with Html Hex IBM Microsoft Key - Html
- How to create Custom RatingBar Android Programming Tutorial - Android
- Cmd command get current directory location - Windows
- Enable and reduce background noise in Microsoft Teams with AI-based noise suppression - Teams
- Google translate in spreadsheet - Google