This version is old school.
Please find jQuery plugins on npm.
Textarea Helper plugin
by Amjad Masad
Makes it possible to query the height of the textarea content and the XY coordinates of the caret position