• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

112
Vistas
Javascript to click a button if screensize is mobile?

I have a calendar displayed on a page that shows the "calendar" view by default, which, does not display well on mobile. The calendar has a button to change to a "list" view.

I am trying to use javascript to click that button if the screen size is less than 767px. The code below is not working. Any help?

Thanks!

<script>
function viewForm(){
  if (window.innerWidth > 767) {
    function buttonclick(){
    var pagebutton= document.getElementsByClassName("fc-listMonth-button");
    pagebutton.click();
    }
  }
};

window.addEventListener('resize', viewForm);
</script>
almost 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

you just need to remove buttonclick function, because you didn't call it.

<script>
function viewForm(){
  if (window.innerWidth > 767) {
    var pagebutton= document.getElementsByClassName("fc-listMonth-button");
    pagebutton.click();
  }
};

window.addEventListener('resize', viewForm);
</script>
almost 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda