Skip navigation
All Places > Canvas Admins > Blog > 2018 > September

The terms list on the account-level course page is sorted in ascending order. When I filter terms, I almost always want the current term or a recent term. Having to scroll to the bottom of our long list of terms is annoying, so I wrote some JavaScript (with the help of Stack Overflow) to sort the list by term ID in descending order. In case anyone else might find this useful, here it is:


if (window.location.pathname.indexOf('accounts') > -1) {
    var selectOptions = $('select optgroup[label="Active Terms"] option');
        return parseInt(b.value) > parseInt(a.value);
    $('select optgroup[label="Active Terms"]').html(selectOptions);


(I welcome tips for improvement, JavaScript aces!)

Filter Blog

By date: By tag: