Sharepoint and Javascript document.getElementById

I needed this today! While developing a custom web part for  Sharepoint 2013, I discovered there are some quirks when writing client-side javascript.

http://chris.gg/2010/02/sharepoint-and-getelementbyid/

Instead of:

document.getElementById(“TextBox1”);

Use this:

document.getElementById(“<%=TextBox1.ClientID %>”);

It’s a bit of a pain to have to do this. But, it works.