Use hasClass() instead of is().