toggle jquery remove others

Solutions on MaxInterview for toggle jquery remove others by the best coders in the world

showing results for - "toggle jquery remove others"
Sara
28 Feb 2020
1$(".nav-link").click(function () {
2  // If the clicked element has the active class, remove the active class from EVERY .nav-link>.state element
3  if ($(this).hasClass("active")) {
4    $(".nav-link").removeClass("active");
5  }
6  // Else, the element doesn't have the active class, so we remove it from every element before applying it to the element that was clicked
7  else {
8    $(".nav-link").removeClass("active");
9    $(this).addClass("active");
10  }
11});
queries leading to this page
how to remove a class every time its toggledadd or remove class with jquerytoggle class two classestoggle remove element from html jquery how to remove toggle in jquerytoggle add remove css property jquerytoggle remove classjquery code to disable toggle jquery replace class toggleadd and remove class jquery on clickjquery toggle add remove elementtoggle replace class jqueryselect classes toggleclasstoggleclass two classesjquery toggle add remove classreverse toggle class button jqueryimg click add class toggle jquery toggle css class for parent elementjquery class being added on second clicktoggle jquery remove othersis there a faster way to write addventlisten click toggle classjquery toggle class of idclick on a add class parrent div toggle jqueryonchange toggleclassjquery change css class on clicktoggle active class jqueryjquery toggleclass if elsehow to toggle 2fremove class on visiblejquery toggle class between multiple elementsjquery class togglebutton toggle class jquerytoggle class in jquerytoggle class only on clicked elementtoggle to class jqueryhow to toggle class in jqueryjquery click toggleclassjquery function toggleclasstoggle jquery activeget button toggle parrent nametoggleclass not applying new value toggleclass jquerytoggleclass at the same time functioninghow to toggle class in jquery on clicktoggle class of items c 23toogle class activeif has class thgen toogletoggle class onclick jqueryremove class then toggle class jquerytoggle and replace class jqueryremove or add class jqueryremove toggle class jqueryclasstoggle with hasclass jqueryjquery remove class after toggleclass addjquery remove class and add from a elementjquery stop toggle classjquery toggle class add removejquery click toggle classjquery class add removeadd class remove class toggle queryjquery toggle remove element toggleclass 28 29 jquerytoggle new div class on click jquery removetoggle classmenu jquery click toggleclasstoggleclass a or b in jquerytoggle class javascript and jqueryjquery remove togglejquery toggle class vs cssjquery toggle removeclass add classtoggle classname jqueryhow to toggle classes using queryjquery should toggle colors on when they are offbutton onclick remove class jquery 24 28this 29 parent 28 27 finder card 27 29 toggleclass 28 27finder active 27 29toggleclass javascriptparent toggle class jqueryjquery toggle button activetoggleclass two classes jqueryremove toggle jqueryclick function toggle classtoggle class jquerytoggleclass jqueryjquery toggle remove contenttoggle classjqueryjquery toggleclass with conditionaljquery find toggleclassadd remove class on toggle jquerytoggle classremove toggle effect in jqueryremove class then toggle class when link clickedhow to addtoggle div in jqjquery toggle class on idjquery add class remove class on same button clcikhow to make toggle class in jquarystop toggle jquerytoggle add remove classtoggle one class add and one class remove same time and after click remove class add and add class remove jqueryon click toggle class jqueryjquery toggle class if have no class then remove ittoggleclass switch classtoggleclass active jqueryonclick add and remove class using jqueryusing jquery 2c remove class 22highlight 22 from the third 3cp 3e tag onclick switch class jqueryjquery toggle class between two elementsjquery how to change toogle of a certain amount by classadd and remove class in jquery on clickhowto use add remove and toggle in jquerytoggle jquery remove others