use the clientID property
document.getElementByID('<%=txtQuantity.ClientID %>')
More info here
you can also use find
Quoted from the link above:
Additionally, ClientID is used in ASP.NET Ajax as a unique identifier for client-side controls. Therefore, the following JavaScript statement is commonly used:
var control = $ find ("<% = MyControl1.ClientID%>");