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

177
Views
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>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

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>
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!