📜  如何使用 jquery 切换 fa fa-caret-down 和 fa fa-caret-up - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:32.086000             🧑  作者: Mango

代码示例1
$(document).ready(function () {
            $('.fa-caret-down').on('click', function () {
                if ($(this).hasClass('fa-caret-down')) {
                    $(this).removeClass('fa-caret-down').addClass('fa-caret-up');
                }else{
                    $(this).removeClass('fa-caret-up').addClass('fa-caret-down');
                }
            });
        });