Skip to content

Instantly share code, notes, and snippets.

@dalyons
Created December 7, 2011 06:14
Show Gist options
  • Save dalyons/1441680 to your computer and use it in GitHub Desktop.
Save dalyons/1441680 to your computer and use it in GitHub Desktop.
js question
Without using jQuery or other external libraries, but assuming a modern browser environment,
write some Javascript to sort the list with id players by their data-rank attribute in
ascending order:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<ul id="players">
<li data-rank="3">3 - Bobby Orr</li>
<li data-rank="1">1 - Wayne Gretzky</li>
<li data-rank="2">2 - Trevor Linden</li>
</ul>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment