Select: Do not inject HTML that is not XHTML compliant

This means insert &#160; instead of &nbsp; and make sure that all $( "<...>" )
that are more than just a single tag have the closing tag.

Fixes #6699