Simplifiying DOM Checking with JQuery