and then unchecks any of the checkbox, then the selectall also should be unchecked automatically.
The jQuery Code
Add following jQuery code in HEAD section of above HTML
Here in above code at line 05, we register a handler on click of selectall checkbox. On click of this checkbox, we check/uncheck all checkbox in the datatable.
Also check the link 13, where we check the selectall checkbox, if all the checkbox are selected manually. To get more idea, play with the below demo.