Почему вторая часть кода не работает($('.hide-filter') ...)

$('.smart-filter-show-more-trigger').on('click', function(e) {
        e.preventDefault();
        $(this).text('Скрыть все');
        $(this).addClass("hide-filter");
        $('.redcode-filter-index-col').fadeIn();
    });
    $('.hide-filter').on('click', function(e) {
        e.preventDefault();
        $('.redcode-filter-index-col').fadeOut();
        $(this).removeClass("hide-filter");
        $(this).text('Скрыть все');
    });

Ответы (1 шт):

Автор решения: CbIPoK2513

Скорее всего ошибка в том, что вы вешаете обработчик на .hide-filter, которых ещё нет, т.к. они "создают" после выполнения первой части кода.

Решение: использовать делегирование событий:

$('.smart-filter-show-more-trigger').on('click', function(e) {
    e.preventDefault();
    $(this).text('Скрыть все');
    $(this).addClass("hide-filter");
    $('.redcode-filter-index-col').fadeIn();
});
$(document).on('click', '.hide-filter', function(e) {
    e.preventDefault();
    $('.redcode-filter-index-col').fadeOut();
    $(this).removeClass("hide-filter");
    $(this).text('Скрыть все');
});
→ Ссылка