Hello. The task is this - you need to assign the badge-danger class when clicking on a link to the sister span element, at the same time if the sister elements of other links in the list have badge-danger - assign the badge-info. I wrote 2 functions, but they work only separately, if together - then only a badge-danger is assigned with a click, and where it already is - it is not reset.
$("#brain_list li a").click( function () { if ($('#brain_list li span').hasClass("badge-danger")) { $('#brain_list li span').removeClass("badge-danger") $('#brain_list li span').addClass("badge-info") } }, function () { $(this).siblings('span').addClass("badge-danger") } );