jQuery: Convert to a single tag
- by user1909565
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.