Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to know if select input has been selected in 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

Comment

PREVIOUS NEXT
Code Example
Javascript :: object js 
Javascript :: inline style react with true or false 
Javascript :: angular get device information 
Javascript :: html to react converter 
Javascript :: delete all the fields on the form whit jquery 
Javascript :: axios.interceptors.response.use 
Javascript :: vue 3 router alias 
Javascript :: jquery get cursor position 
Javascript :: javascript textarea autosize 
Javascript :: js create element with class 
Javascript :: firebase auth api key not valid. please pass a valid api key 
Javascript :: binary addition javascript 
Javascript :: check for string anagram javascript 
Javascript :: react dynamic import 
Javascript :: js object keys 
Javascript :: Divide the number in js 
Javascript :: regex quantifiers 
Javascript :: js addeventlistener foreach 
Javascript :: javascript nested functions 
Javascript :: lodash sort json 
Javascript :: document.queryselectorall extract all href element 
Javascript :: javascript push object into array with variable key 
Javascript :: react native password meter 
Javascript :: innertext data form js 
Javascript :: clean collection mongoose 
Javascript :: vuejs does props factory function have access to vue instance 
Javascript :: how to get the current time of a audio in js 
Javascript :: no special characters express validator 
Javascript :: addeventlistener javascript 
Javascript :: match string in array javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =