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

146
Views
querySelectorAll selecciona todas las clases similares

Calendar está usando 3 clases diferentes para diseñar sus elementos secundarios: "viejo día", "día", "nuevo día". Intentar consultar el elemento SelectorAll con el nombre de clase "día" también captura las otras dos clases, así que cuando digo algo como:

 t = document.getElementByTagName('table'); d = t.item(0).querySelectorAll('.day'); /* also selects td.new.day and td.old.day */ for (i = 0; i < d.length: i ++) { if(d[i].textContent == 28) { d[i].click(); } }

Haré clic en el 28 anterior en lugar del 28 del mes actual.

¿Cómo selecciono la clase "día" del elemento td sin seleccionar también "día anterior" y "día nuevo"?

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

0

Puede usar :not para especificar qué clases no desea hacer coincidir.

 document.querySelectorAll(".red:not(.big):not(.small)").forEach(e => { e.style.marginLeft = "100px"; });
 .red {color: red;} .big {font-size: 20px} .small {font-size: 12px}
 <a class="red">red</a><br> <a class="red big">red big</a><br> <a class="red small">red small</a>

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!