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

164
Views
JavaScript: hacer un evento de clic en computadoras de escritorio y dispositivos móviles para agregar una lista de CSS

Traté de agregar clase a CSS al hacer clic en un botón y funciona en el escritorio pero no funciona en el teléfono móvil

aquí está mi código:

 <script> document.getElementById('logbit').addEventListener('click',function() { document.getElementById('logf').classList.add('bg'); }) </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

No sé por qué está usando una etiqueta jquery si no está usando jquery en su código.

Pero como preguntaste sobre jquery, te daré una respuesta de jquery.

 $("#logbit").click(function() { $("#logf").addClass("bg"); })

Eso debería funcionar tanto en el teléfono como en la PC.

about 4 years ago · Juan Pablo Isaza Report

0

A ver si esto funciona:

 <style> .bg { background-color: blue; } </style> <input type="button" value="Button" id="button"> <script> document.querySelector("#button").onclick = function () { document.body.classList.add("bg"); } </script>
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!