how to turn a text input field into option select menu without reloading the page?

how to turn a text input field into option select menu without reloading the page?

To save space on small phones, I would like to be able to change the function of a text field into a select menu option and vice versa. 

How is it possible?