function removeTextAreaWhiteSpace() {
var myTxtArea = document.getElementById(‘txtQuestion’);
myTxtArea.value = myTxtArea.value.replace(/^\s*|\s*$/g, ”);
}

Call above function “removeTextAreaWhiteSpace()” onfocus event of textarea. e.g. onfocus=”removeTextAreaWhiteSpace()”