How to hide jQuery datatables

23,418

Solution 1

Try this

$('#example').parents('div.dataTables_wrapper').first().hide();

Solution 2

i think the best way is to include the table inside a div and hide the div

 <div id='divTable'>
     <table>
     </table>
 </div>

 $('#divTable').hide();
Share:
23,418
Rajaram Shelar
Author by

Rajaram Shelar

I am a software developer, a Microsoft certified technology specialist. Like web development specially using C#/Asp.Net/MVC/Jquery/AWS/Microservices/DynamoDB. Love freelancing and knowledge sharing.

Updated on July 09, 2022

Comments

  • Rajaram Shelar
    Rajaram Shelar almost 2 years

    How do I to hide jQuery datatables, when I want to toggle the datatable's visibility? The problem is if I write hide statement it only hides the rows, not the headers and footer. How can I hide datatable fully?

    For hiding, I used the below code:

     var oTable = $('#example').dataTable(); // 'example is the table id'
     oTable.hide();