Crunchytoast.com

What’s better than toast? Crunchytoast!

crunchyt sez:

This is my first website ... after 15 years of making them for everyone else! Hope you enjoy it too.

This is only a quickie, but important enough to spread the word (oh, btw IE blows!)

In all versions of Internet Explroer (IE 5,6,7,8 apparently), the browser silently creates an immutable global variable for every element ID. This can lead to naming clashes when using jquery.

For example, I had the following code:
startDate = $('#startDate');

Here the DOM element ID is startDate. However, whenever I tried to access the jQuery functions such as startDate.attr() or startDate.val(), i received this terse Internet Explorer error:

“Object doesn’t support this property or method”

Simply by renaming your local variable to something else, such as myStartDate, you can avoid this problem! Peace at last.

Kudos shout out to Rick Strahl whose March 2009 post is the only resource I found confirming this!

Leave a Reply