I am trying to add class using if and else,but its not working beyond if not reaching to else.
$('.headings aside').click(function() {
if ($(this).children('span').hasClass("fa-caret-up")) {
$(this).children('span').addClass('borderGap');
alert("Hello! I am an alert box!!");
} else {
alert("Second Alert");
$(this).children('span').removeClass('borderGap');
};
});
Thanks in advance
$(this).children('span')into a variable, there is no reason to keep looking it up.