24

I'm trying to remove the words "Search:" from the filter label in DataTables. I have tried to use jQuery to replace the label dom but when replaced the filter will not work. Any one have any other solutions?

Well seems everybody wants code:

<div id="table-staff_wrapper" class="dataTables_wrapper">
<div id="table-staff_length" class="dataTables_length">
<div id="table-staff_filter" class="dataTables_filter">
<label>
Search:
<input type="text">
</label>
</div>
<table id="table-staff" cellspacing="0" cellpadding="0">
<div id="table-staff_info" class="dataTables_info">Showing 1 to 3 of 3 entries</div>
<div id="table-staff_paginate" class="dataTables_paginate paging_full_numbers">

the above is auto generated by DataTables

6
  • can you paste in the code? The people here like to read code instead of sentences .... Commented Nov 24, 2011 at 6:09
  • Sentences are nice too, but code brings in context ;) Commented Nov 24, 2011 at 6:10
  • can you elaborate little more about the technology are you using .. and if it is javascript and html then create jsFiddle for this.. Commented Nov 24, 2011 at 6:11
  • hi, there is no code for me to paste. Unless I can post a picture. But anyone familiar with jQuery DataTable would know the Search Box which is used as a filter. I am trying to remove the words, I just want the box only. Commented Nov 24, 2011 at 6:12
  • please read and understand before add a -1. The code that I'm dealing with is auto generated, and therefore I can't really elborate much Commented Nov 24, 2011 at 6:16

7 Answers 7

63

refer this link http://datatables.net/ref#sinfo

add this thing to your code--

"oLanguage": { "sSearch": "" } 

even if you don't get what you wished then you can simply post the same question on dataTable forum...dataload team will assist you...

Hope it will help you..

Sign up to request clarification or add additional context in comments.

1 Comment

A more specific link to the properties in the oLanugage object: datatables.net/reference/option/language
13

You must initialize datatables like this:

$('#yourtable').dataTable({
//your normal options

  "oLanguage": { "sSearch": "" } 

});

Comments

8

For datatables 1.10.10 (& possibly above), you can use following configuration while creating the datatables instance:

$('.datatable').DataTable({
// other initialization configurations...
// ...
    "language": {
        "search": "_INPUT_",
        "searchPlaceholder": "Search..."
    }
});

For more details, here is the link from DataTables site: https://datatables.net/reference/option/language.searchPlaceholder

Comments

7

For Datatables 1.9.4 and above you can use this

$('#yourtable').dataTable({
//your normal options

  "language": { "search": "" } 

});

Comments

4

Put placeholder when you remove search label

$("#data-table").DataTable({
   language: { search: "",searchPlaceholder: "Search..." }
});

Comments

0

try below code:

jQuery("level").html("") or 
jQuery("level").text("") or 
jQuery("level").get(0).text("") 

this will get all the level tag element,

since there is only on ehere use index 0.

It will find level element and set the value as ""

Comments

0

For some reason Placeholder wasn't working for me. So, My workaround for removing Label and Putting place holder is,

$('#RecentLogs').dataTable({
      "oLanguage": { "sSearch": "" }
});

So, above code will remove search label. And for placeholder.

$('.dataTables_filter input').attr("placeholder", "Search Here");

Note :- Be sure that you are including placehoder's jquery line after datatable's initialization and after loading external js of datatable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.