How to use set choices in javascript

Can anybody tell me how to use set choices in javascript? I have a textbox displaying and can make the choices appear however I have no idea how to make them do anything. As of right now it just closes the conversation when i choose an option, I want to be able to start a new textbox and display a different message when you select an option. Any help would be greatly appreciated.
Look at how command windows are handled... I've not yet dabbled in MV so fat but back in Ace, you set an "ok handler" for each "choice" in a command window, the "ok handler" being the method that will be executed when that "choice" is activated

Original thread: https://forums.rpgmakerweb.com/threads/how-to-use-set-choices-in-javascript.58193/