猿问

如何从 row-id 中删除类?

我想仅删除类选定的行,因为在 laravel 中foreach loop我有多行,如下所示:


<tr>

  <td>

    <a class="remove-d-none">Use</a>

    <div class="d-none manue">

     </div>

  </td>

</tr>


<tr>

  <td>

    <a class="remove-d-none">Use</a>

    <div class="d-none manue">

     </div>

  </td>

</tr>

我想要这样,如果用户仅单击第一行,则应删除其类,因此我尝试了以下方法:


$('.remove-d-none').on('click', function(){

    $('.menu').removeClass('d-none');

});

但这似乎不起作用。有人知道如何提供帮助吗?


MMMHUHU
浏览 101回答 1
1回答

慕妹3242003

$('.remove-d-none').on('click', function() {&nbsp; &nbsp; $(this).siblings(".manue").removeClass("d-none");});<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><table id="table">&nbsp; <tr>&nbsp; &nbsp; <td>&nbsp; &nbsp; &nbsp; <a class="remove-d-none">Use</a>&nbsp; &nbsp; &nbsp; <div class="d-none manue">&nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; </td>&nbsp; </tr>&nbsp; <tr>&nbsp; &nbsp; <td>&nbsp; &nbsp; &nbsp; <a class="remove-d-none">Use</a>&nbsp; &nbsp; &nbsp; <div class="d-none manue">&nbsp; &nbsp; &nbsp; </div>&nbsp; &nbsp; </td>&nbsp; </tr></table>
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答