<p>
<div id='text' contenteditable=true style='width:100px;height:100px;border:1px #ccc;'>abc</div>
</p>
<script>
function test1(){
var div = document.getElementById("text");
var range = document.createRange();
var len = div.childNodes.length;
range.setStart(div, len);
range.setEnd(div, len);
getSelection().addRange(range);
div.focus();
}