user2571510
user2571510

Reputation: 11377

jQuery / Data Tables: replace default filter field / text

I am using the jQuery DataTables plugin to style a table (source: https://datatables.net/).

By default this shows an input field on top of a table that is used for searching / filtering the table with a default text "Search:" appearing in front of it. Checking this in Firebug shows the parent div with the following details: id="MyTableID_filter" class="dataTables_filter"

Can someone tell me a way to change this text or to replace the div content or is there a buil-in option that allows this ?

Many thanks for any help with this, Tim.

Upvotes: 0

Views: 5224

Answers (1)

Drixson Oseña
Drixson Oseña

Reputation: 3641

Try putting something like this in your script. That's allows you to modify the behaviour of your datatable. You can read here for your references

$("#datatable").dataTable({
            "bJQueryUI": false,
            "bAutoWidth": false,
            "oLanguage": {
        "sEmptyTable": "No incompleted albums found!", //when empty
                    "sSearch": "<span>Filter records:</span> _INPUT_", //search
                    "sLengthMenu": "<span>Show entries:</span> _MENU_", //label
                    "oPaginate": { "sFirst": "First", "sLast": "Last", "sNext": ">", "sPrevious": "<" } //pagination
            }
        });

Upvotes: 9

Related Questions