In the above example, we have created a paragraph element and span element. We have assigned "default" class to paragraph element. We have created buttons respective to elements, to check whether elements has class "default" assigned to them or not using hasClass() method.