The 'Search' input length limit

The 'Search' input length limit

ViktoriaViktoria Posts: 2Questions: 1Answers: 0

I'm using datatable's filtering:

var table = $("#myTable").DataTable({
                ajax: {
                columns: [...
               filter: true,            

I would like to ask is there a length limit of the 'Search' input field?
Is it possible to set such a limit?
Thank you in advance for your help.

This question has an accepted answers - jump to answer


  • bindridbindrid Posts: 730Questions: 0Answers: 119
    Answer ✓

    There is not one but you can add one easy enough with your preinit hanlder

    $(document).ready( function () {
      $(document).on("preInit.dt", function(){
        $(".dataTables_filter input[type='search']").attr("maxlength", 5);
      var table = $('#example').DataTable();
    } );
  • ViktoriaViktoria Posts: 2Questions: 1Answers: 0

    Thank you so much! It works perfectly!

This discussion has been closed.