how to get values from select multiple in js
document.getElementById('submit').onclick = function() {
var selected = [];
for (var option of document.getElementById('pets').options) {
if (option.selected) {
selected.push(option.value);
}
}
alert(selected);
}
Also in JavaScript:
- Get requests return html code instead of real data
- js test if string
- js replace all symbols in string
- displaying the date react
- Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.ts(1219) angular
- set dropdown in jquery
- csv export in react
- cJSON_CreateObject
- javascript reduce
- javascript detect textarea change
- permission api js
- react native init project
- js scroll to top
- discord.js MessageEmbed
- json-server localhost
- angular http client
- js get base url
- laravel csrf token ajax post
- javascript get file extension from string
- declare array in javascript
- javascript string replace
- faker javascript name escape apostrophe
- add jquery to page
- javascript validate email