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

162
Views
¿Cómo puedo "hacer clic" en todos los div en la consola de Firefox?

¿Cómo puedo realizar una acción de "clic" en todas las filas que comienzan con "label style-scope ytcp-button" en el siguiente html:

 <div class="label style-scope ytcp-button">Edit Draft</div>

Aquí lo que probé

 $("div[class^=label style-scope ytcp-button]")​​​​​​​​​​​​​​.click();

parece que no funciona.

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

0

Puede usar el método JS simple querySelectorAll() .

 const els = document.querySelectorAll('.label.style-scope.ytcp-button'); els.forEach((el) => { el.click(); console.log('clicked'); });
about 4 years ago · Juan Pablo Isaza Report

0

Te has perdido el apóstrofo. Deberías escribir así:-

 $("div[class^='label style-scope ytcp-button']").click();

Ejecute el fragmento de código a continuación, no ejecutará el método de alerta al hacer clic en el último div ya que falta la clase " ytcp-button " en el último div.

 $(document).ready(function(){ $("div[class^='label style-scope ytcp-button']").click(function(){ alert("You have Click a Specific Class"); }); });
 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div class="label style-scope ytcp-button">It will Show Alert</div> <div class="label style-scope ytcp-button">It will Show Alert</div> <div class="label style-scope ytcp-button">It will Show Alert</div> <div class="label style-scope">It will not Show Alert</div> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <script src="script.js"></script> </body> </html>

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!