> Other than the $('#id').hide() example, you aren't going to > get very far when a selection fails, and it will make debugging a > little weird if you don't throw an error at some point.
What is erroneous about selecting no elements? Here is an example of using chaining to significantly reduce code, and it takes advantage of having empty jQuery objects: http://groups.google.com/group/jquery-en/browse_frm/thread/71d5c139c36b8561 Even though he had something working, Marcelo (the thread starter) was asking, "How can I use jQuery features to make this better?" I'm still wondering whether debussy007 (the starter of this thread) made the question too narrow, and could solve the bigger problem by not doing this check at all.