add onSelect event, passing the element selected as a argument