just change getAttribute to hasAttribute... little error