jQuery code snippet to find the index of the option that has been selected from within a select element.
Use jQuery's index function to return the index of the item that matches the ':selected' selector within the children of the select element.
Example: