Add clearInput flag to clearOptions()

Only clear user input when clearInput is true or undefined.

The undefined check is to make sure this change doesn't break any existing code.