Link to home
Start Free TrialLog in
Avatar of APD Toronto
APD TorontoFlag for Canada

asked on

this.hasClass is not a function

Hi Experts,

I have the following code
$(document).ready(function(){

    //expand/collapse detail data
    $('.spMobile').on('click', function(){
        var expand = this.hasClass('fa-caret-right');
    });

});//document ready

Open in new window


With which I am trying to determine if the cliked element has the class fa-caret-right, but I am getting the following error

VM3768 functions.js:6 Uncaught TypeError: this.hasClass is not a function
    at HTMLSpanElement.<anonymous> (VM3768 functions.js:6)
    at HTMLSpanElement.dispatch (jquery-3.2.1.js:5206)
    at HTMLSpanElement.elemData.handle (jquery-3.2.1.js:5014)

Open in new window


Any help will be greatly appreciated.
ASKER CERTIFIED SOLUTION
Avatar of Flabio Gates
Flabio Gates

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial