Reputation: 3159
This may be super easy to crack, but I'm just not getting this to work: I want to remove a class from the child node: I'm accessing the lastchild like below: code:
Ext.select(".item").elements[0].lastChild
o/p:
<table class="abc test hide test123">
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
I want to remove the class="hide
" and replace it with class="show"
, so it'll render:
<table class="abc test show test123">
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
here is how the entire structure looks:
<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>
so <table>
is the lastchild of parent classitem
.
how can I do this?
Upvotes: 0
Views: 436
Reputation: 76679
with ExtJS
it works alike this (compared to DOM manipulation with JS
):
Ext.select(".item > *:last-child").removeCls("hide").addCls("show");
^ that's only recommended when running against plain HTML markup, not ExtJS components.
Upvotes: 0