XF 2.2 Toggle form in mobile view not working

FoxSecrets

Active member
I implemented a toggle form, it works on desktop view but not in mobile view.

I can see the function working in mobile view however do not toggle the form.

Is there any special setup to run javascript in Xenforo mobile view?

Code:
  function toggleForm(event) {
    var form = document.getElementById('search-form');
    form.classList.toggle('hidden-form');
    console.log(form.classList);
  }

1709897370978.webp

Code:
<div class="block-container">
    <div onclick="toggleForm()" id="toggleButton">
      <h3 class="block-header">{{ phrase('search') }}</h3>
    </div>

    <xf:form action="{{ link('xxxxx') }}" id="search-form" class="block hidden-form">
      My form
    </xf:form>
  </div>

Code:
.hidden-form {
    display: none;
}
 
Nothing special for mobile is required. The JS isn't exactly idiomatic to XF but I don't see at a glance why there would be a discrepancy. You might want to try using remote debugging tools.
 
The console log? There are tools which will let you attach your browser's developer tools to a remote session.

 
Back
Top Bottom