How do I add a non-breaking whitespace in JavaScript without using innerHTML? July 28, 2023 by Tarik You can use a unicode literal for a non breaking space: var foo = document.createTextNode("\u00A0");