JSFiddle - React, Tailwind, and code Playground

HTML

<div><span>content</span>&nbsp;&nbsp;<span>content</span></div>

JavaScript

var div = $('div').html();
alert('before: ' + div);
alert('after: ' + div.replace(/&nbsp;/g, ''));