Can't Get Filter Placeholder to Work

Can't Get Filter Placeholder to Work

eweisbroteweisbrot Posts: 23Questions: 6Answers: 0

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

  • eweisbroteweisbrot Posts: 23Questions: 6Answers: 0

    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

  • eweisbroteweisbrot Posts: 23Questions: 6Answers: 0

    Bump :)

  • allanallan Posts: 63,356Questions: 1Answers: 10,444 Site admin

    I would suggest using language.searchPlaceholder.

    Also your line of code works just fine for me on your page :-)

    Allan

  • eweisbroteweisbrot Posts: 23Questions: 6Answers: 0

    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.

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395
    Answer ✓

    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.

  • eweisbroteweisbrot Posts: 23Questions: 6Answers: 0

    That worked. Thanks!

This discussion has been closed.