Properly support onselect event