I have a menu, and in it when I click on a certain block, it becomes active, but when I click on the next one, it should stop being active. I wrote everything as in the example, but for some reason they continue to stand in active states.
$(document).ready(function(){ $('div[id^=block]').hide(); $('li.view').click(function(){ $('ul.Mynav>li:not(li.view)').**removeClass**('active'); $(this).**addClass**('active'); $('div#block1').fadeIn(200); $('div[id^=block]:not(div#block1)').fadeOut(200); }); $('li.company').click(function(){ $('ul.Mynav>li:not(li.company)').removeClass('active'); $(this).addClass('active'); $('div#block2').fadeIn(200); $('div[id^=block]:not(div#block2)').fadeOut(200); }); });
.active{ background-color:#3399ff; }
I rechecked several times ... (in the video for which the site did, it is said that add adds and disables (something like), but does not work. https://jsfiddle.net/acac2c7n/ Here.