<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.5.2.js'></script>
<script type='text/javascript'>
$(window).load(function(){
$result = $("a > #MyImage");
console.log($result.length);
});
</script>
</head>
<body>
<a href='' ><img id="MyImage"></a>
</body>
</html>