added onSelect event

onSelect returns the index selected