this.document.getElementById('maincomment').value code example
Example 1: getelementbyid
document.getElementById("someid");
Example 2: javascript get element by id
var myElement=document.getElementById("someElementID");
document.getElementById("someid");
var myElement=document.getElementById("someElementID");