window.getSelection() of textarea not working in firefox?

It appears getSelection does not work on text selected in form fields due to this Firefox bug.

As explained in this answer, the workaround is to use selectionStart and selectionEnd instead.

Here is a modified example that works correctly:

http://jsfiddle.net/AVLCY/1/

Leave a Comment