JavaScript: Getting the last option value in a select

From The Travis van der Font Wiki
Jump to: navigation, search
jQuery:
$('#select_id option:last').val();
JavaScript:
var _select   = document.getElementById('select_id');
var lastValue = _select.options[_select.options.length-1].value;

console.log(lastValue);