I would like to limit substr to words, not characters. I think about regex and spaces, but don't know how to do this.
Scenario: limit a paragraph of words to 200 words using javascript / jQuery.
var $postBody = $postBody.substr(' ',200);
It's great, but it splits the words in half :) Thanks in advance!
user201063
source
share