check in fix for #586

Redoing pull request.

Added event monitor ('input') in order to add or remove the clear button based on the number of characters.