1. Home
  2. Computing & Technology
  3. JavaScript
photo of Stephen Chapman
Stephen's JavaScript Blog

By Stephen Chapman, About.com Guide to JavaScript since 2004

Split a Line

Friday July 3, 2009
JavaScript can provide advanced text manipulation.

One problem with splitting text across multiple lines in JavaScript is how to avoid splitting the line in the middle of a word. This function will examine the line contents for you to most effectively split the text within your specified line length without splitting any words that are short enough to fit on one line.

Split a Line
Comments

No comments yet. Leave a Comment

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.