Friday, May 6, 2011

Display current line and column number for a textarea.

I'm making a file edit interface in my web-app, I have a textarea with file contents.

When textarea is focused, I want to output the position of the cursor, i.e. line number and column: this is useful because error messages usually yield a line number, for example.

The question is: how do I figure out the position of the cursor in textarea? I'm using prototype library. Maybe there's a solution already?

I'm not really interested in fancy toolbars for the textarea, which are offered by those advanced widgets.

From stackoverflow

0 comments:

Post a Comment