Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2987
  • Last Modified:

removing newline characters javascript

how can i remove new line characters in javascript

ex: "hello there

      good morning


      Thanks".

the final result should be "hello there good morning thanks".
0
cognos79
Asked:
cognos79
  • 2
1 Solution
 
william007Commented:
This function will be helpful to you
http://www.rgagnon.com/jsdetails/js-0041.html
0
 
cognos79Author Commented:
thanks a lot william it worked..
0
 
william007Commented:
welcome:)
0
 
HonorGodCommented:
 That is very verbose...


  str = "hello there\r\n\r\n\tgood morning\r\n\r\n\r\n\tThanks";

  str = str.replace( /[\r\n\t]/g, '' );
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now