Nick LaMarca Nick LaMarca - 1 month ago 14
Javascript Question

Create A Blank Html Space On The Fly Javascript

How do I create a blank space on the fly using javascript?
The following is not working for me..

var blank = document.createElement(" ");
div.appendChild(blank);

Answer

If you really just want to append a space character, use the following:

div.innerHTML += ' ';

or

div.innerHTML += ' ';

for the HTML entity.

Comments