Learning Web App Development

by Semmy Purewal

minor error in tabs

page 135

17 May 2014

On page 135, there's a minor error in the section called 'Creating the tab functionality.'

When building the functionality for the third tab, we have to make sure to select the third child of the tabs. Specifically, the code that looks like this:

$(".tabs a:nth-child(3)").on("click", function () {
    $(".tabs span").removeClass("active");
    $(".tabs a:nth-child(2) span").addClass("active");
    $("main .content").empty();
    return false;
});

Should look like this:

$(".tabs a:nth-child(3)").on("click", function () {
    $(".tabs span").removeClass("active");
    $(".tabs a:nth-child(3) span").addClass("active");
    $("main .content").empty();
    return false;
});

Thanks to Gilbert Desport and Ken Hommel for reporting this!