You missed the point .for hasClassand hasClassreturn boolean, so further binding will not be possible if a jQuery object is required. You can use a class selector with a type selector.
. hasClass ()
The .hasClass () method will return true if a class is assigned.
The .hasClass () method will return true if a class is assigned to an element, even if other classes are also
$( "tr.add-css" ).filter( ":odd" ).css( "background-color", "blue");
OR
$( "tr.add-css:odd" ).css( "background-color", "blue");
source
share