[javascript] How to remove leading and trailing white spaces from a given html string?