If you MUST use spaces, use .
The use of innerHTML creates a potential security risk for your website. Malicious users can use cross-site scripting (XSS) to add malicious client-side scripts that steal private user information stored in session cookies.
var text = text. replace(/\s/g, ' '); \s will match any white space character, such as space, tab and new line. If you only want to replace space, use / /g instead.
I have this javascript for adding white space between two buttons, I just created and inserted in a div
:
document.getElementById("divID").appendChild(buttonONE);
document.getElementById("divID").innerHTML + =" ";
document.getElementById("divID").appendChild(buttonTWO);
There is a space between the two buttons, but is always just one space, like if you had pressed the space-bar only once.
How can I increase these spaces to more than one?
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With