Programming Tips - jQuery: get html select options as an array?

Date: 2018jul5 Language: javaScript Library: jQuery Q. jQuery: get html <select> options as an array? A. Use $('#myselect option') like this
function getSelectOptions(id) { var a = []; $('#' + id + ' option').each(function() { a.push($(this).val()); }); return a; }