views:

93

answers:

1

How can I make a programmatical page selection visible to the user, as if it was selected by the user?

var range = document.createRange();
var startPar = [some node];
var endLi = [some other node];
range.setStart(startPar,13);
range.setEnd(endLi,17);

Thank you.

+1  A: 

Use:

window.getSelection().addRange(range);
Andy