User:GhostInTheMachine/SortWhatLinksHere.js

function SortWhatLinksHere($el) { $el.append(   $el.children.sort( (a,b) => a.innerHTML < b.innerHTML ? -1 : a.innerHTML > b.innerHTML ? 1 : 0 ) );  $.each($el.children, (i,$sub) => SortWhatLinksHere($($sub).find('ul'))); }

$(function{ SortWhatLinksHere($('#mw-whatlinkshere-list')); });