Handling the select item event