A few days ago I worked on a project where I needed to select all the content on an input field. In most of the cases this can be done by using the
document.getElementById("p1").selectionStart = 0
document.getElementById("p1").selectionEnd = 999
And this hack works perfectly! Maybe you will need these two lines somedays. I searched a lot to get the final answer...