check if object is defined in jquery to avoid errors
<p>In case that there is an objects called (id) "ABC123", I want to scroll down automatic to that object. That works fine if this object exist. But if not, I receive an error:
<strong>"TypeError: $(...).offset(...) is undefined"</strong></p>

<p>My code should avoid this error, but doesn't work:</p>

<pre><code>if(typeof($('#ABC123')) != 'undefined') {
        $('html, body').animate({ scrollTop: ($("#ABC123").offset().top-100) }, 0).scroll();
    }
</code></pre>
