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

313
Views
querySelectorAll con inclusión Y exclusión de condiciones de atributos (ambos)

La tarea es encontrar todos los elementos que tienen valores en el atributo "href", que cumplen 2 condiciones al mismo tiempo:

  1. contienen :// cadena
  2. no comienzan con la cadena http://internal.com

Entonces necesito algo como

const targetHrefs = document.querySelectorAll('[name="list"] ~ ul > li > a[href*="://"][href^="http://internal.com"]');

donde la segunda condición debe ser con el operador NO

¿Es posible usar la única regla Selector de CSS?

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

0

Solo ponlo en un :not ?

 const targetHrefs = document.querySelectorAll('a[href*="://"]:not([href^="http://internal.com"])'); console.log(targetHrefs.length); console.log(targetHrefs[0]);
 <a href="foo"></a> <a href="https://example.com/"></a> <a href="http://internal.com/"></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!