Function onselect

    Fires when the current selection changes.