Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get all values of a select javascrip

//u have to put a unique id on your html select tag!
var options = document.getElementById('mySelectID'). options;
/*u can use this istead if u dont have an id in your select,
if u have only 1 select in your html*/
var options = document.querySelector('select').options;

//options.length gives the array dimension of var options
for (let i = 0; i < options. length; i++) {
//log the value.
console. log(options[i]. value);
}  
Comment

js select get all options value

$("#mySelectID option").toArray().map(p=>p.value)
Comment

javascript get all options from select

x.options.length
Comment

PREVIOUS NEXT
Code Example
Javascript :: react navigation hide header 
Javascript :: jQ - on image load 
Javascript :: how to add multiple styles in javascript 
Javascript :: map size 
Javascript :: javascript array from string 
Javascript :: react usememo vs usecallback 
Javascript :: children array javascript 
Javascript :: react useEffect prevent first time 
Javascript :: Solution for Error [ERR_REQUIRE_ESM]: require() of ES Module 
Javascript :: validação de email email@email.com 
Javascript :: Activelink.js 
Javascript :: javascript create form element 
Javascript :: forever.js 
Javascript :: Content security policy (csp) javascript 
Javascript :: js array pop 
Javascript :: nodejs fs writefile base64url 
Javascript :: check radio button jquery 
Javascript :: else statement 
Javascript :: node global directory windows 
Javascript :: import and export type in js 
Javascript :: google tuner 
Javascript :: ion icon react 
Javascript :: AngularJS how to use btn-group or radio group in list 
Javascript :: angular httpclient post body 
Javascript :: javascript string error 
Javascript :: function declaration and function definition in javascript 
Javascript :: javascript date validation less than today 
Javascript :: chrome.storage.local delete 
Javascript :: react router reload page not found 
Javascript :: how to create an element in js using the map method 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =