Use the index() function to find an element within a set. Construct a set of all the options using $("#end option")
. Find the selected option using the :selected pseudo-element. Note: indexes are 0-based.
var options = $("#end option");
var idx = options.index(options.filter(":selected"));