Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
De la lista de elementos, establezca la opacidad en 0 si es una determinada etiqueta

Tengo una lista de elementos de una llamada querySelectorAll y quiero configurar todos los elementos que son etiquetas <g> para que tengan opacidad 0. Sin embargo, no estoy seguro de cómo funcionaría una declaración if como esta.

 useEffect(() => { var elements = document.querySelectorAll(`[id^='tooth-${props.toothnumber}']`); var svg = document.querySelector('svg') console.log(svg) var elms = svg.querySelectorAll(`:not([id^='tooth-${props.toothnumber}'])`) for(var i = 0; i < elms.length; i++) { if (elems[i] is ag tag) { elms[i].style.opacity = 0 } } }, [props.toothnumber])

Algún consejo

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

let gList = document.querySelectorAll('g'); for(var i = 0; i < gList.length; i++) { gList[i].style.opacity = 0; }
about 4 years ago · Juan Pablo Isaza Report

0

¿No puedes simplemente agregar g al selector de consultas?

 useEffect(() => { var svg = document.querySelector('svg') var elms = svg.querySelectorAll(`g:not([id^='tooth-${props.toothnumber}'])`) elms.forEach((element) => element.style.opacity = 0) }, [props.toothnumber])
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!