Is there a way to rearrange the order of some HTML elements using JavaScript or jQuery?
From this:
<div class="link-wrap">
<a href="#">001</a>
<a href="#">002</a>
<a href="#" class="move-this">003</a>
<a href="#" class="move-this">004</a>
<a href="#" class="move-this">005</a>
</div>
To looks like this:
<div class="link-wrap">
<a href="#" class="move-this">003</a>
<a href="#" class="move-this">004</a>
<a href="#" class="move-this">005</a>
<a href="#">001</a>
<a href="#">002</a>
</div>
That means whatever <a>
with class move-this
will be moved before others following their original order.
The challenge is that, there is no way to change the existing HTML code due to some limitations; not even to add classes or attributes to it. So, no idea how to do so after some research and testing yet.