Change CSS for specific Table
Change CSS for specific Table
ybathia
Posts: 5Questions: 2Answers: 0
I have multiple datatables on a single page and I would want to change the css of the search input box of only one of my tables. All the examples suggest using $('.dataTables_filter input').css('color', 'white'); but by using dataTables_filter input, it changes the css of all my search input boxes.How can I change the css of just one table?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Assign an id to the table (if you haven't already), then DataTables will use that id for the wrapper element - giving the wrapper (i.e. the
div
that contains all of the DataTables "stuff") the id{tableId}_wrapper
.For example, if your table is
id="myTable"
the wrapper is generated asid="myTable_wrapper"
.Then you can use simple selectors to target a specific table:
$('#myTable_wrapper .dataTables_filter input')
.Allan
Thanks @allan