I have search many hours to accomplish this but not get success to achieve last i tried [Stack overflow link][1]


  [1]: https://magento.stackexchange.com/questions/262834/magento-2-category-page-add-custom-view-mode
and also add my custom jQuery in list.phtml file 

    <script>
        require(['jquery'], function ($) {
            jQuery(document).ready(function () {
                $(".mode-grid").click(function () {
                        alert('call Grid');
                        $('.mode-grid').addClass('active');
                        $('.mode-list').removeClass('active');
    
                    }
                );
                $(".mode-list").click(function () {
                    alert('call List');
                    $('.mode-list').addClass('mode-list active');
                    $('.mode-grid').removeClass('mode-grid active');
                });
            });
        });
    </script>
but not get success, please help me to solve this ,i am new in magento so also inform me where i make mistakes thank you