Usuń przestrzeń z JavaScript String
var str = " Hello World! ";
alert(str.trim());
Unusual Unicorn
var str = " Hello World! ";
alert(str.trim());
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );
<div style="white-space:pre-wrap"> <!-- New Line -->
<!-- 2 space --> This is my text
</div>