Get value of last option of a drop down?
html, javascript
Solution
With jQuery it's super easy:
var lastValue = $('#idOfSelect option:last-child').val();
With plain Javascript it's not much worse:
var theSelect = document.getElementById('idOfSelect');
var lastValue = theSelect.options[theSelect.options.length - 1].value;
Problem
I have dropdown menu..which is dynamic.. How can get value of the last item in that drop down (using jquery is also acceptable)