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

324
Views
seleccionar id contiene barra con querySelectorAll no funciona
<h2 id="example/123">A heading</h2> <script> document.querySelectorAll("#example/123"); </script>

¿Alguna idea de por qué la identificación anterior no funciona? ¿Necesito una biblioteca adicional para escapar de / ??

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

0

Puede escapar del / usando \\ .

 <h2 id="example/123">A heading</h2> <script> document.querySelectorAll("#example\\/123"); </script>

¿Duplicado del selector CSS para seleccionar una identificación con una barra en el nombre de la identificación?

Sin embargo, en este caso, está utilizando una identificación, por lo que puede obtener el elemento específico sin necesidad de obtenerlo de NodeList usando document.getElementById(), ya que solo un elemento debe tener esa identificación.

 document.getElementById("hello/world");
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!