排序<a>s a-z html

时间:2016-10-28 03:50:00

标签: javascript html css sorting

I am trying to have an ability to sort a bunch of buttons by their contents alphabetically A-Z. I want to make a button that will make them sort. I have seen from other sources ( http://jsfiddle.net/hibbard_eu/C2heg/)如何使用javascript对Div进行排序,但由于这些是<a>我需要帮助才能实现此目的。

编辑:这不是数据列表。我需要从内容中删除以找到名称并对其进行排序。

例如

html:

<a href="#" class="myButton" style="width:202px; text-align:center; margin-bottom: 3px;" id="internetbutton">Surfing On The Internet</a>
<a href="#" class="myButton" style="text-align:center; margin-bottom: 3px;" id="spongebutton">Sponge Bob Trap Pants</a>
<a href="#" class="myButton" style="text-align:center; margin-bottom: 3px;" id="sadbutton">Too Sad 4 Me</a>
<a href="#" class="myButton" style="text-align:center; margin-bottom: 3px;" id="congabutton">Conga</a>
<a href="#" class="myButton" style="width:84px; text-align:center; margin-bottom: 3px;" id="seinfeldbutton">Seinfeld</a>

这些只是我的几个按钮。我宁愿尝试避免使用jQuery,因为我从未使用过该库。谢谢!

0 个答案:

没有答案