Horje
How to check if an item is selected from an HTML drop down list with javascript js Code Example
How to check if an item is selected from an HTML drop down list with javascript js
// See the below HTML first
/*
<select id="cardtype" name="cards">
    <option value="mastercard">Mastercard</option>
    <option value="maestro">Maestro</option>
    <option value="visadebit">Visa Debit</option>
</select>
*/

// Javascript Solution
var select = document.getElementById("cardtype");
var selectedValue = select.options[select.selectedIndex].value;

// Courtesy: Sachin - https://stackoverflow.com/users/1041642/sachin





Javascript

Related
** in javascript Code Example ** in javascript Code Example
how to get current date in express js Code Example how to get current date in express js Code Example
remove div by class name javascript Code Example remove div by class name javascript Code Example
webpack setup proxy manual Code Example webpack setup proxy manual Code Example
how to use ternary operatiion in sequelize join statement Code Example how to use ternary operatiion in sequelize join statement Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9