I am having a cross browser issue with the offset() function in jQuery. For example, I am looking for the offset of an anchor tag
offset()
eg. $(\'#anchori
$(\'#anchori
I get this problem in IE8 when my script is loaded on a page where the element that we want to get the offset().top of does not exist.
offset().top
I solved it like this:
if ($('#element').length){ $('#element').offset().top // ... }
Never execute offset().top if the element does not exist.