sharathdaniel
9/20/2018 - 6:33 AM

Toggle class and text

<span class="label label-success label-success-chng">Active</span>
$('.label-success-chng').on('click', function(){
    $(this).toggleClass('label-danger label-success');
    if($(this).hasClass('label-danger')) {
        $(this).text("Inactive");
    }
    else {
        $(this).text("Active");
    }
});