Web textarea

Is there a way to work out what line in a text box the cursor is currently in?

In JavaScript, you can get the position of the cursor, like SelStart in Desktop.

https://stackoverflow.com/questions/263743/how-to-get-the-caret-position-in-a-textarea-in-characters-from-the-start

I am not aware of ways to find the line.