How may I sort a list alphabetically using jQuery?

后端 未结 10 2142
灰色年华
灰色年华 2020-11-21 23:13

I\'m a bit out of my depth here and I\'m hoping this is actually possible.

I\'d like to be able to call a function that would sort all the items in my list alphabeti

10条回答
  •  悲&欢浪女
    2020-11-21 23:51

    Put the list in an array, use JavaScript's .sort(), which is by default alphabetical, then convert the array back to a list.

    http://www.w3schools.com/jsref/jsref_sort.asp

提交回复
热议问题