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.

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.

Leave a comment