Is there a way to add a clear icon?

I want to use CodeMirror editor as a single line with an x clear icon at the end. When the x is clicked the line will clear. Is there an easy way to do this?


Just add the icon somewhere in the nearby DOM and position it over the editor, and add a click handler to it that deletes all the text in the editor?