As the previous reply indicated -- this is Javascript -- and it is using -- most likely jQuery. I am responding because -- this snippet is accessing the DOM and making assumptions that are causing it to fail -- without grace and without any real way to provide much information, but -- the exception seems to indicate that the node being accessed is not present. This is not a good way to find the element in question and the code has been written in an odd manner because the author has not taken the time to understand nodes -- if you do not do this, your only options moving forward are to write code like this and hope for the best, or abdicate the responsibility by using a 3rd party client side library for that. To make matters worse, this issue of textContent vs. innerText -- is a well known difference between browsers and how they view whitespace in documents -- particularly XML documents. It behooves a developer to take the responsibility of learning how to walk the DOM themselves and to check for null -- at least once. How do you know where you are in the DOM otherwise? This script -- needs a lot of work to be robust --