The original HTML codes are like this:
<div>
<ul class="alt">
<li> <a class="button1"> Button1 </a></li>
<li> <a class="button2"> Button2 </a></li>
</ul>
</div>
And then I’d like to change it to this:
<div>
<a class="button1"> Button1 </a>
</div>
Does anyone know how to implement this in jquery?
you can get fist elemnt by either
.first()or:first Selectoror try
Jsfiddle