EDITABLE CODE:
LiveDemo:jQuery - hasClass() Method
Note:The hasClass() method only examines the first matched element.