Could you use <code>!$elm.attr( attr )</code> instead?