How to detect when user selects text in a textarea with JS?
I used jQuery-fieldselection ,but it works only if the range.text is putted into a pre tag.It doesn't work with div.
views:
48answers:
2"JavaScript nl2br: Converts newlines to HTML line breaks"
Ondra Žižka
2010-07-12 00:01:55
+3
A:
Use the select event. It works for <textarea> and <input type="text"> elements in all mainstream browsers. Support is not universal for other elements.
document.getElementById("your_textarea").onselect = function() {
alert("Select");
};
Tim Down
2010-07-11 22:26:41