Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

changing the active class on press

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

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

        var $parent = $(this).parent();
        $parent.addClass('active');
        e.preventDefault();
    });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: min of an array javascript 
Javascript :: generate random string javascript 
Javascript :: js check if objects have same values 
Javascript :: add border to view react native 
Javascript :: javascript add button to div 
Javascript :: string to title case javascript 
Javascript :: converting json to javascript object 
Javascript :: moment to date 
Javascript :: js get sum of array of objects 
Javascript :: eof while parsing 
Javascript :: jquery remove closest parent 
Javascript :: eliminar el ultimo caracter de un string javascript 
Javascript :: javascript trim spaces 
Javascript :: toggle bollean value in js 
Javascript :: for in object javascript 
Javascript :: json get key 
Javascript :: repeat react component n times 
Javascript :: how to calculate distance between two points in javascript 
Javascript :: javascript generate 3 numbers 1 - 49 
Javascript :: react native linking email 
Javascript :: difference between backtick and quotes 
Javascript :: axios withcredentials 
Javascript :: spring rest api cors error in react app 
Javascript :: componentdidupdate in hooks 
Javascript :: how to show bootstrap 5 modal using jquery 
Javascript :: js sort 1 or -1 
Javascript :: javascript how to raise the error 
Javascript :: react native zindex issue on android 
Javascript :: nuxt js if is client 
Javascript :: move file from one folder to another in aws s3 nodejs 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =