jquery - HTML、CSS 和 JQUERY - 在表格中隐藏第一个 child 和最后一个 child 图标

标签 jquery html css css-selectors

我有一张 table ,其中一张是这样的:

<td class="acciones" width="20%">
     <span class="btn-group-action">
     <!-- EDITAR -->
     <span data-toggle="tooltip" class="btn-group label-tooltip" data-original-title="Editar" data-html="true" data-placement="left">                                                    
                                                    <!-- <a class="btn btn-default " href="<?php echo base_url('diccionarios/elemento_especifico_diccionario').'/'.$elemento['ELDI_Id'];?>" title="Editar">
                                                        <i class="material-icons">edit</i>
                                                    </a> -->
                                                    <a class="btn btn-default editar_elemento_diccionario" title="Editar">
    <i class="material-icons">edit</i>
  </a>
 </span>
<!-- BORRAR -->
<span class="btn-group label-tooltip eliminar_elemento_diccionario" id='<? 
   php echo $elemento['ELDI_Id']; ?>' title="Eliminar" data-toggle="tooltip">
   <a class="btn btn-default" href="#"><i class="material-icons">delete</i> 
   </a>  
</span>  
</span>

 <span class="btn-group-action" style="margin-right:3.46px">
 <!-- BAJAR POSICIÓN -->
 <span data-toggle="tooltip" class="btn-group label-tooltip" data-original- 
   title="Bajar posición" data-html="true" data-placement="left">                                                    
   <a class="btn btn-default bajar_posicion_elemento" title="Bajar 
 posición">
<i class="material-icons">arrow_drop_down</i>
</a>
</span>
<!-- SUBIR POSICIÓN -->
<span data-toggle="tooltip" class="btn-group label-tooltip" data-original- 
title="Subir posición" data-html="true" data-placement="left">                                                    
<a class="btn btn- 
default subir_posicion_elemento" title="Subir posición">
<i class="material- 
icons">arrow_drop_up</i>
 </a>
</span> 
 </span>
 </td>

我需要这样做:

  • 如果 td 是第一个,则必须隐藏它的 subir_posicion_elemento。
  • 如果 td 是最后一个,则必须隐藏它的 bajar_posicion_elemento。

我不知道该怎么做,我尝试使用 CSS 但无法使其工作。

感谢您的宝贵时间。

编辑

图像显示了我需要隐藏的图标: enter image description here

编辑2

好吧,我终于想通了,所以这就是答案,很简单,但我对 css 不了解>。<

CSS:

tr:first-child .subir_posicion_elemento, tr:last-child .bajar_posicion_elemento {
display:none;
}

最佳答案

使用此 CSS 代码隐藏表格中的第一个子图标和最后一个子图标:

 table tr td:first-child .subir_posicion_elemento{ 
        display:none;
    }
    table tr td:last-child .bajar_posicion_elemento { 
        display:none;
    }

关于jquery - HTML、CSS 和 JQUERY - 在表格中隐藏第一个 child 和最后一个 child 图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51667405/

相关文章:

javascript - $.ajax 函数未按预期工作

javascript - jQuery:使 hide() 和 show() 正常工作时遇到问题

javascript - JS - Canvas - 同时在两个 Canvas 上绘制 - ?馈送两个变量?

html - [object Object] 和 [object HtmlDivElement] 之间的区别。 Div 玩转 jQuery

javascript - Javascript 在 Internet Explorer 中生成的 html 代码出现问题

javascript - if($(var).css ('display' ) == "block") 与 slideToggle?

css - 如何在包含多个引导行的两列之间添加垂直分隔符?

javascript - 如何计算 slideToggle() 的速度

jquery - 使用 jquery 获取数组中的所有图像?

javascript - 如何以响应方式使下面的文本位于框的中心?