kim de castro
kim de castro

Reputation: 309

Custom search box using your own <input type="text">

As you can see in this example jQuery DataTables has a search box function.

I want to create customized search box design. Is it possible to create your own using the code below outside the DataTables?

<input type="text" id="search" name="search"> 

Upvotes: 1

Views: 123

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58880

Please see Search API example and how Global search is implemented.

For example, you can use the code below where search is ID of your search box:

$(document).ready(function() {
    $('#example').DataTable();

    $('#search').on( 'keyup click', function () {
       $('#example').DataTable().search(
           $('#search').val()
       ).draw();
    } );     
} );

Upvotes: 1

Related Questions