• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2991
  • 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

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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