How to sort unordered List items by element attributes?

  node.js, question

For example, li elements all have a width attribute, which varies in size. How can li elements be reinserted into the unordered List from small to large according to the width attribute?

Please describe your problem in detail, such as whether the width of your li element is automatically adapted or you give it manually?