jQuery: Convert to a single tag
Posted
by
user1909565
on Stack Overflow
See other posts from Stack Overflow
or by user1909565
Published on 2012-12-17T10:24:51Z
Indexed on
2012/12/17
11:03 UTC
Read the original article
Hit count: 110
jquery-selectors
I want to convert the below HTML to single tag: Before :
<div class="Parent1">
<div class="Child1">
<a href="#">Child1</a>
</div>
<div class="Child2">
<a href="#">Child2</a>
</div>
</div>
<div class="Parent2">
<div class="Child1">
<a href="#">Child1</a>
</div>
<div class="Child2">
<a href="#">Child2</a>
</div>
</div>
After :
<div class="Parent1">
<button>Child1</button>
<button>Child2</button>
</div>
<div class="Parent2">
<button>Child1</button>
<button>Child2</button>
</div>
i tried with wrapping/unwrapping. But it does not work. This I want to be generic.
© Stack Overflow or respective owner