OK, simple:
self = $(this);
Throws a JavaScript error in IE8 when it's inside an event handler. It works in every other browser.
var self = $(this);
Throws no error. Why?
OK, simple:
self = $(this);
Throws a JavaScript error in IE8 when it's inside an event handler. It works in every other browser.
var self = $(this);
Throws no error. Why?
The answer is that var keyword staring back out at you.
When you reference just plain self, you're referencing a global variable and IE won't let you change it. When you write var self you're declaring a local variable.