`return jQuery(element).attr(attrName) !== undefined;` is safe, regardless if the element exists or not.

Not necessarily better, just point it out.