Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

remove and add active class with jquery

$(document).ready(function () {
    $('.nav li').click(function(e) {

        $('.nav li').removeClass('active');

        var $this = $(this);
        if (!$this.hasClass('active')) {
            $this.addClass('active');
        }
        //e.preventDefault();
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: remove square brackets from string javascript 
Javascript :: This error occurred during the build time and cannot be dismissed. 
Javascript :: javascript generate unique letters and numbers id 
Javascript :: dockerignore node modules 
Javascript :: jquery scroll to top 
Javascript :: javascript leave page warning 
Javascript :: create new react app 
Javascript :: if array is empty jquery 
Javascript :: javascript how to check for an empty object 
Javascript :: react props.children proptype 
Javascript :: react native clear cach 
Javascript :: Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps 
Javascript :: javascript trello title swap 
Javascript :: random number javascript 
Javascript :: Setting a background Image With React Inline Styles 
Javascript :: array join javascript new line 
Javascript :: add comma to number javascript 
Javascript :: brain.js cdn 
Javascript :: leaflet.js cdn 
Javascript :: regex only uppercase letters js 
Javascript :: arrow not showing react slick 
Javascript :: jquery get form data 
Javascript :: python request text to dict 
Javascript :: remove element by class 
Javascript :: remove special characters regular expression 
Javascript :: how to remove the last character of a string in javascript 
Javascript :: javascript distance between two points 
Javascript :: jquery add class 
Javascript :: jquery if null or empty 
Javascript :: remove all numbers from string javascript 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =