Sometimes we faced the problem of toggling the class in html because of only by changing the classes can do a different action in html.
Toggle class means exchange the class names. We can toggle class using jQuery as follows:
$(document).ready(function(){
if($('#id').hasClass('active'))
$('#id').removeClass('active').addClass('deactive');
else
$('#id').removeClass('deactive').addClass('active');
})