first remove active class from classlist and append to current element using javascript
function myFunction(e) {
if (document.querySelector('#navList a.active') !== null) {
document.querySelector('#navList a.active').classList.remove('active');
}
e.target.className = "active";
}
Also in JavaScript:
- string contains javascript
- react native add custom fonts
- if browsertab is active jquery
- not operator js
- jasmine spy return value when using create Spy Object angular 2
- JS get random number between
- add an image to a div with javascript
- vue js getter
- check online status javascript
- how to get file name in directory node js
- calculator
- change the border of an image js
- javascript add to a dictionary
- get last element of array javascript
- js if mobile browser
- javascript span style
- axios api post request
- javascript hasownproperty
- javascript get last character of string
- get only last 2 digit of year in javascript
- convert data into json format in javascript
- filter
- is knex built into node js
- date.parse string to javascript