Skip to content

Instantly share code, notes, and snippets.

@fwextensions
Created June 14, 2012 00:33
Show Gist options
  • Save fwextensions/2927376 to your computer and use it in GitHub Desktop.
Save fwextensions/2927376 to your computer and use it in GitHub Desktop.
Code to get the number of chars and words in a text element
var r = [], t;
if (el && el.textRuns) {
t = el.textChars;
r = ["chars:", t.length,"words:", t.split(/\s+/).length];
}
r.join(" ");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment