Sort a set of li tags alphanumerically

前端 未结 3 1272
轮回少年
轮回少年 2021-01-21 05:53

I\'ve been playing around trying to get a function that will sort a selection of li tags by their content but currently to no avail (at least no speed/accuracy);



        
3条回答
  •  一向
    一向 (楼主)
    2021-01-21 06:32

    If you want to sort it with javascript, you need a method/function to sort it. And you need to choose when it will be sorted: loading, clicking on a button, etc...

    The other possibility is to sort before sending the html: it depends on your server language. Php, java, asp, etc... ? But you can use the same link to find the best algorithm for your needs.

提交回复
热议问题