Skip to content

Instantly share code, notes, and snippets.

@arufian
Last active August 29, 2015 14:08
Show Gist options
  • Select an option

  • Save arufian/cf773069d7f9ecd0b33a to your computer and use it in GitHub Desktop.

Select an option

Save arufian/cf773069d7f9ecd0b33a to your computer and use it in GitHub Desktop.
To make a new line (<br />) on the text every 10 chars
var makeNewLine = function(texta) {
var retval = texta;
if (texta.length > 10) {
retval = '';
var iter = texta.length / 10;
for (var i = 0; i < iter; i++) {
retval += texta.substring(i * 10, ((i + 1) * 10)-1);
retval += '<br />';
}
}
return retval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment