<!DOCTYPE html>
<html>
<title>W3.JS</title>
<script src="/lib/w3.js"></script>
<body>

<h2>Sort List</h2>

<p>Click the button to sort the list alphabetically:</p>
<button onclick="w3.sortHTML('#id01', 'li')">Sort</button>

<ul id="id01">
  <li>Oslo</li>
  <li>Stockholm</li>
  <li>Helsinki</li>
  <li>Berlin</li>
  <li>Rome</li>
  <li>Madrid</li>
</ul>

</body>
</html>

Sort List

Click the button to sort the list alphabetically:

  • Oslo
  • Stockholm
  • Helsinki
  • Berlin
  • Rome
  • Madrid