Learning Web App Development

by Semmy Purewal

missing line in makeTabActive

page 136

17 May 2014

On page 137, there’s a missing line in the makeTabActive function.

Specifically, the function needs to empty the main content div so that the new content can be added. The full function should look like this.

var makeTabActive = function (tabNumber) {
    // construct the selector from the tabNumber
    var tabSelector = ".tabs a:nth-child(" + tabNumber + ") span";
    $(".tabs span").removeClass("active");
    $(tabSelector).addClass("active");
    $("main .content").empty();
};

Thanks to Ken Hommel for reporting this!