I'm having trouble selecting all contents of the div. Here's a demo:
http://jsfiddle.net/KcX6A/304/
It's selecting only the first line of texts, the other lines are ignored. How can I fix this?
EDIT:
By browser is google chrome
SECOND EDIT:
Too bad i'd be answering my own question. But here i've got it to work on Google Chrome:
I've replaced
selection.setBaseAndExtent(text, 0, text, 1);
with
selection.selectAllChildren(text);
and it worked like a charm! Please guys inform me if it works with other browsers as well.
Working Demo
It seems that removing webkit specific calls to setBaseAndExtent fixes issue in latest Chrome
http://jsfiddle.net/KcX6A/309/
I believe you need to use innerHTML (or was it outerHTML) to get the entire text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With