Can't Get Filter Placeholder to Work
Can't Get Filter Placeholder to Work
Hello,
I tried using a solution that was found to work on these forums in order to place text within the search filter bar, which is:
$('.dataTables_filter input').attr("placeholder", "enter seach terms here");
However, this is not working for me. When I check it in Chrome developer tools, it gives me an error of "Uncaught SyntaxError: Unexpected token (". I don't see any missing brackets or semi colons. Any idea where the issue is?
Thanks in advance!
This question has an accepted answers - jump to answer
Answers
Oh...and you can see where I have this implemented here:
http://199.119.123.135/surety-bonds/licensed-states/california_surety_bond-mike.htm
Bump :)
I would suggest using
language.searchPlaceholder
.Also your line of code works just fine for me on your page :-)
Allan
Hey Allan,
Thanks for the response. I currently have the code that I referenced above commented out, as it breaks my table.
I tried using language.searchPlaceholderDT, but I still can't get the placeholder to work. Any ideas what the issue is? I'm lost.
Your DataTables initialisation is a mess.
$('#bonds').DataTable( {
responsive: true,
"dom": '<f<t>lip>',
"oLanguage": {
"sSearch": "Find the bond you need:"},
language: {searchPlaceholder: "Search records"}
});
Using 1.10.1 or greater, "language" replaces "oLanguage" - do not use both.
That worked. Thanks!