I\'ve found a couple resources for how to place the cursor in a textarea at the end of the text, but I can\'t sort out a simple way to make it appear at the beginning.
Depending on your needs, a simpler Javascript version is:
document.querySelector("textarea").focus(); //set the focus - cursor at end
document.querySelector("textarea").setSelectionRange(0,0); // place cursor at start
You can't just string them together either, to get rid of the double querySelector - not sure why.