I always add this little jQuery snippet at the beginning of my JS files
jQuery.fn.exists = function(){return jQuery(this).length>0;}
This uses the same approach many here have suggested, but it also allows you to access whether or not an object exists like this:
if ( $('#toolbar').exists() ){
$('#toolbar').load(..., function(){...});
//etc...
}