Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

target all element besides the clicked one

let color = document.querySelectorAll('.color')
let gold = 'gold'

color.forEach(
  (c) => c.onclick = (e) => {
      color.forEach(
        (c) => c.classList[e.target==c?'toggle':'remove'](gold)
      )
    }
)
Comment

PREVIOUS NEXT
Code Example
Javascript :: input search picture jquery 
Javascript :: javascript node await .click 
Javascript :: fix your timestep javascript 
Javascript :: javascript seo url parameters 
Javascript :: ngx-doc-viewer 
Javascript :: change items per page pagination angularjs 
Javascript :: turf greatcircle example 
Javascript :: Mongoose multi update req.body 
Javascript :: momentDurationFormatSetup 
Javascript :: how to run multple port node 
Javascript :: react redux cheat sheet 
Javascript :: puppeteer js onblur 
Javascript :: button inside popover not viible 
Javascript :: .env file vars nto defined in child directory 
Javascript :: youtbe trailer npm 
Javascript :: adding a terminal iframe 
Javascript :: most popular company with nodejs 
Javascript :: useful javascript code snippet for console 
Javascript :: prefix increment 
Javascript :: ajax comet 
Javascript :: show ingoing node on click cytoscape.js 
Javascript :: chunks bug vue js 
Javascript :: dom javascript cheat sheet 
Javascript :: chroma js 
Javascript :: js remove plus 
Javascript :: currentVal 
Javascript :: generate random rgb color javascript 
Javascript :: Gif Animation on Image jquery 
Javascript :: Create your own query selector shorthand 
Javascript :: show selected text in textarea && activeElement 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =