Oh sorry, simple comparison won't work here since you are doing substring search. Ok, but then you really should use Dom.hasClass().