javascript abstraction for <select> as a component