JavaScript

Invalid Property in Internet Explorer

I recently spent an hour trying to figure out why once piece of JavaScript code was working fine in FireFox but not in Internet Explorer.

When I eventually installed some IE JavaScript debugging tools and pinpointed the problem I was surprised to find that it was my used of a colours name. Apparently IE does not support grey as a colour and you must specifically give the hexadecimal colour value. It was only for testing that this code was been used but I learnt my lesson the hard way and will never again be using colour names.

Object doesn't Support this Property or Method

Well if you have reached this post then you was probably having the same problem as me. At first the error message might seem quite generic but when I tell you what was causing the error for me it will all make sense.

In my case I had a div with the same id as a JavaScript variable on the same page. So once my page had been parsed up to the div the JavaScript variable/object which was declared before the div was no longer a valid object and any calls to methods or properties of that object further down the page were invalid / not supported.