/* write a fuction that sum the value of a select control */ function sumSelect() { var sum = 0; var select = document.getElementById('select'); for (var i = 0; i < select.options.length; i++) { sum += parseInt(select.options[i].value); } return sum; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter