javascript - jquery bound event doesn't fire on mobile phones -


heyho,
want bind event html tablerow. seems work on common desktop browsers not on mobile phone browsers. tested on iphone 6 , android devices.
here's related fiddle,
, code:

$("body").on("click", "tr", function(){       //do  }) 

i can't use click event on tablerow (which seems work) because table generated after pageload. input.

i found solution: adding

cursor: pointer;

css style tablerow fix problem. don't understand why, because don't have cursor on mobile devices works, what.

$("body").on("click", "tr.prim", function(){        $(".sec").fadetoggle();    })
.sec {      display: none;  }  .prim {      cursor: pointer;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>  <table border="1" cellspacing="0" cellpadding="0" width="300">      <tr height="100" class="prim" bgcolor="#ffb7b7">          <td></td>          <td></td>          <td></td>      </tr>      <tr height="100" class="sec" bgcolor="#ef4a4a">          <td></td>          <td></td>          <td></td>      </tr>      <tr height="100" class="sec" bgcolor="#ef4a4a">          <td></td>          <td></td>          <td></td>      </tr>  </table>


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -