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

Thursday April 24, 2008
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

More from About.com

  1. Home
  2. Computing & Technology
  3. JavaScript

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

All rights reserved.