Удалить пространства в струне JS
str.replace(/\s+/g, '')
Dangerous Duck
str.replace(/\s+/g, '')
var str = " Hello World! ";
alert(str.trim());
var str = '/var/www/site/Brand new document.docx';
document.write( str.replace(/\s/g, '') );