Test for empty jQuery selection result

Solution 1:

Use the s.length property.

if(s.length == 0) {
    ...
}

[edit] size() deprecated in jquery 1.8 http://api.jquery.com/size/

Solution 2:

if($("#something").length > 0 ){
     // Element found
}
else{
    // No element found
}