Switch two column's visibility with one click
Switch two column's visibility with one click

Hello, I know how to Hide or Show a column with toggle-visibility
Toggle column: <a class="toggle-vis" data-column="2">Select Courses</a> - <a class="toggle-vis" data-column="3">Courses Enrolled</a>
combined with the technique on https://datatables.net/examples/api/show_hide.html.
However: Is there a way to Hide Column 2 and Show Column 3 with One Click? .. And then switch back to Show 2 and Hide 3?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Yes. Use
column().visible()
. Just modify the example a bit to specify the column, like this:KEvin