Pricing switcher...how do they do this??

Hi guys. Please see this pricing page at Swiftype: https://swiftype.com/pricing

Click on the month/year buttons above the pricing table - and the price in the table changes in real time, no refreshing.

How do they do this?

I've looked in the page source, and there is this script:

// make the billing period selected tabs work
    $(function() {
      var $pricingTable = $('#pricing-table');
      $('#billing-picker .tab').click(function() {
        var $selectedTab = $(this);
        var selectedPeriod = $selectedTab.data('period-length');
        $('.tab').removeClass('selected');
        $selectedTab.addClass('selected');
        $pricingTable.removeClass().addClass(selectedPeriod);
      })
    });

which of course marries up to the classes in the html.

But I can't get it to work. What else is the missing link?

If anyone has any ideas, would love to hear them! And I would definitely donate some community points love to anyone who can help me solve it.

Thanks, AB.