I'm having trouble selecting the entire contents of a div. Here is a demo:
http://jsfiddle.net/KcX6A/304/
It selects only the first line of texts, the remaining lines are ignored. How can i fix this?
EDIT:
The browser contains google chrome
SECOND EDIT:
It is a pity that I would answer my question. But here I have to work in Google Chrome:
I replaced
selection.setBaseAndExtent(text, 0, text, 1);
from
selection.selectAllChildren(text);
and it worked like a charm! Please guys tell me if it works with other browsers.
Working demo
source share