Hide Bootstrap toggle Sidebar by default on page load using jQuery in ASP.Net

lingers
 
on Aug 06, 2021 03:19 AM
784 Views

Please i want to hide toggle sidebar on page load, then display it when i click on the home button.

But it displays now on page load but only disappears when i click on home button.

<script type="text/javascript">
    $(document).ready(function () {
        $('#sidebarCollapse').on('click', function () {
            $('#sidebar').toggleClass('active');
        });
    });
</script>

please help

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Aug 06, 2021 03:26 AM

Add trigger click event on page load in $(document).ready event.

<script type="text/javascript">
    $(document).ready(function () {
        $('#sidebarCollapse').on('click', function () {
            $('#sidebar').toggleClass('active');
        });

        $("#sidebarCollapse").trigger('click');
    });
</script>