As I write this, two of the top answers (including the accepted answer) are incorrect despite being pointed out nearly five years ago. attr("selectedIndex") does nothing, because selectedIndex is a property on the actual DOM element, not an HTML attribute. You need to use prop:
$(this).prop('selectedIndex')
Interactive demo comparing this to the incorrect version: http://jsfiddle.net/uvwkD/