Walter Nuñez Walter Nuñez - 3 months ago 15x
jQuery Question

jquery remove all spaces and line break before any character character

hello friend i am cleaning some response from server becouse i dont have time to search all php files, space and line break in output, from buffer php...

in a response of ajax i get a paragraph of text, and i need remove all space and line break before anyone character and respect all: space and line break.


response = response.replace(/\s+/g, '');

this not respect Line Break or space on paragraph from response


Solved with this Update. regex

response = response.replace(/^\s+|\s+$/g,'');