Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

toggle jquery remove others

$(".nav-link").click(function () {
  // If the clicked element has the active class, remove the active class from EVERY .nav-link>.state element
  if ($(this).hasClass("active")) {
    $(".nav-link").removeClass("active");
  }
  // 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
  else {
    $(".nav-link").removeClass("active");
    $(this).addClass("active");
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: prisma studio 
Javascript :: get the size of the screen javascript 
Javascript :: how to conver time format to 12 hours in javascript 
Javascript :: mongoose generate new ObjectID 
Javascript :: discord javascript how to create a role 
Javascript :: jquery datetimepicker format 
Javascript :: check all after click first checkbox jquery 
Javascript :: check balance of a wallet in js 
Javascript :: float force loopback 
Javascript :: cannot find module loader 936 
Javascript :: get api call in jquery 
Javascript :: jquery add items to select input 
Javascript :: axios header accept language 
Javascript :: force update react hooks 
Javascript :: javascript change data attribute value 
Javascript :: divide array of objects to 4 arrays js 
Javascript :: angular generate component 
Javascript :: ngx paypa remove credit card 
Javascript :: npm i react query 
Javascript :: check whether a checkbox is checked in jQuery 
Javascript :: node.js http request ip address 
Javascript :: jquery on change function not working 
Javascript :: ajaxcall 
Javascript :: webpack-bundle-analyzer no stats.json file 
Javascript :: jquery if attribute 
Javascript :: remove duplicates from array js lodash 
Javascript :: popup alert in flutter 
Javascript :: com.fasterxml.jackson.databind.exc.unrecognizedpropertyexception unrecognized field 
Javascript :: go to nextelementsibling js 
Javascript :: sort an array by characters length in js 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =