国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - bootstrap table 如何獲取事件并執(zhí)行某個(gè)方法
PHP中文網(wǎng)
PHP中文網(wǎng) 2017-04-11 13:33:32
0
3
330

bootstrap table 獲取行點(diǎn)擊事件onClickRow,并獲得所點(diǎn)擊的row,然后調(diào)用alert顯示所點(diǎn)擊行的id

PHP中文網(wǎng)
PHP中文網(wǎng)

認(rèn)證高級(jí)PHP講師

reply all(3)
Peter_Zhu

這個(gè)可以用jQuery獲取你點(diǎn)擊的是第幾個(gè)tr,假設(shè)是i,然后你想獲取id,應(yīng)該把tr的id設(shè)置為你想獲取的那個(gè)id,當(dāng)你點(diǎn)擊獲取了i之后就可以獲取第i個(gè)tr的id了

因?yàn)槟銢]有貼相應(yīng)的代碼,所以我也就不貼代碼了。。。不懂可以追問

阿神

jquery的$(this).index()

洪濤
    <table>
      <thead>
        <tr onclick="clickRowByInline(this)">
          <th>1</th>
          <th>2</th>
          <th>3</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>1</td>
          <td>2</td>
          <td>3</td>
        </tr>
        <tr>
          <td>1</td>
          <td>2</td>
          <td>3</td>
        </tr>
      </tbody>
    </table>
    <script src="http://cdn.bootcss.com/jquery/3.1.1/jquery.min.js"></script>
    <script>
      function clickRowByInline(e) {
        console.log(e);
      }

      $('tbody tr').on('click', clickRow);
      function clickRow(ev) {
        console.log(ev.currentTarget);
      }
    </script>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template