Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Foundation, React throw "el.data(...).split is not a function" when click on toggle button

When i insert html block (below) from foundation documentation, into react component

  <div className="top-bar" id="top-bar">
    <div className="top-bar-title">
      <span data-responsive-toggle="responsive-menu" data-hide-for="medium">
        <button className="menu-icon dark" type="button" data-toggle></button>
      </span>
      <strong>Site Title</strong>
    </div>
    <div id="responsive-menu">
      <div className="top-bar-left">
        <ul className="dropdown menu" data-dropdown-menu>
          <li>
            <a href="#">One</a>
            <ul className="menu vertical">
              <li><a href="#">One</a></li>
              <li><a href="#">Two</a></li>
              <li><a href="#">Three</a></li>
            </ul>
          </li>
          <li><a href="#">Two</a></li>
          <li><a href="#">Three</a></li>
        </ul>
      </div>
      <div className="top-bar-right">
        <ul className="menu">
          <li><input type="search" placeholder="Search"/></li>
          <li><button type="button" className="button">Search</button></li>
        </ul>
      </div>
    </div>
  </div>

is throwing error when click on toggle button

el.data(...).split is not a function
like image 474
Vladimir Buskin Avatar asked Dec 14 '22 23:12

Vladimir Buskin


1 Answers

problem is withing data-toggle attribute. react render the line below

    <button className="menu-icon dark" type="button" data-toggle></button>

to

    <button class="menu-icon dark" type="button" data-toggle="true"></button>

so specifing =""

    <button className="menu-icon dark" type="button" data-toggle=""></button>

fixes the problem

like image 67
Vladimir Buskin Avatar answered Jan 03 '23 17:01

Vladimir Buskin