首页 > 解决方案 > 如何使用 EXTJ 从元素的 lastChild 中删除类名

问题描述

这可能非常容易破解,但我只是没有让它工作:我想从子节点中删除一个类:我正在访问 lastchild,如下所示:代码:

Ext.select(".item").elements[0].lastChild

o/p:

<table class="abc test hide test123">
  <tbody>
      <tr>
         <td></td>
     </tr>
  </tbody>
</table>

我想删除class="hide" 并将其替换为class="show",因此它将呈现:

<table class="abc test show test123">
      <tbody>
          <tr>
             <td></td>
         </tr>
      </tbody>
    </table>

这是整个结构的外观:

<div class="item">
   <div></div>
<div class="abc test hide"></div>
<div class="abc5643"></div>
<div class="abide"></div>
<table class="abc test hide test123">
   <tbody>
              <tr>
                 <td></td>
             </tr>
          </tbody>
</table>
</div>

<table>父类的 lastchild 也是如此item

我怎样才能做到这一点?

标签: extjs

解决方案


这是小提琴

更换后:

更换后


推荐阅读