How to get search input or whatever element in the table?

How to get search input or whatever element in the table?

CamoCamo Posts: 33Questions: 6Answers: 0

I need to change some definitions on elements in the table. But I am not able to get it.
I find this code somewhere

    "initComplete": function () {
        var api = this.api();
        api.$('.dataTables_filter input').addClass('form-control');
        console.log(api.$('.dataTables_filter'));           }

Console shows empty result for the selector. Thanks.

Answers

  • kthorngrenkthorngren Posts: 21,182Questions: 26Answers: 4,925

    You are using [jQuery addClass()](https://api.jquery.com/addclass/) chained from an instance of the Datatables API which won't work. Try removing theapi.` for just this:

    $('.dataTables_filter input').addClass('form-control');
    

    Kevin

  • CamoCamo Posts: 33Questions: 6Answers: 0

    Thanks you. I really dont know where I found it.

Sign In or Register to comment.