Javascipt select a sentence in textarea

Posted by John Adawan on Stack Overflow See other posts from Stack Overflow or by John Adawan
Published on 2010-03-12T09:06:34Z Indexed on 2010/03/12 9:17 UTC
Read the original article Hit count: 486

Filed under:
|

I'm thinking if there is a way to use javascript to pick up ANY ONE sentence from a textarea simply by clicking any position within that sentence.

I'm thinking along the line of - first, get current cursor position (which I know how) - second, somehow locate the position of the previous fullstop and the next fullstop (how?) - take whatever content within the two fullstops. (how?)

Or there is a simple way to do it?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about textarea