var numberOfPara = $("p").length;
if( numberOfPara == 0 )
alert("No paragraph found in this HTML document...");
else
alert("jQuery found "+ numberOfPara +" paragraphs on this page!");
if( $("#someDiv").length ) // true if equal to 1
alert("The element 'someDiv' exists!");
if( $("#someDiv").length && $("#someDiv:visible").length )
alert("The element 'someDiv' exists, and it is visible!");
Tip: see this tutorial to check where the element is (above / below the fold, out of sight...)
if( $("#someDiv").length && $("#someDiv:hidden").length )
alert("The element 'someDiv' exists, but it is hidden!");
$(function(){
// The document is now ready...
});