I know that you can test for width() or height() but what if the element's display property is set to none? What other value is there to check to make sure the element exists?
Assuming you are trying to find if a div exists
$('div').length ? alert('div found') : alert('Div not found')
if ($("#MyId").length) { ... write some code here ...}
This from will automatically check for the presence of the element and will return true if an element exists.