filter label

filter label

GiovanniGiovanni Posts: 9Questions: 2Answers: 0
edited October 2013 in General
Hi all,
I'm using datatables to display a sport ranking and I would like to move the search label inside the filter box instead outside. How could I do it?

Thanks

G

Replies

  • desslochdessloch Posts: 5Questions: 0Answers: 0
    edited October 2013
    You can remove the search text next to the box by adding
    [code]
    oLanguage: {
    sSearch: ''
    }
    [/code]
    to the initialization.

    oSearch doesn't seem to work, but oLanguage does. Straight js/jquery works for setting the input:
    [code]
    $('#table_id .dataTables_filter input').val('Search...')
    [/code]
  • GiovanniGiovanni Posts: 9Questions: 2Answers: 0
    Thanks a lot. It works using .attr() instead of .val()

    G
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'd suggest using the `placeholder` attribute rather than setting the value. Won't work in old browsers of course, but that's what the user gets if they are using an old browser ;-)

    Allan
This discussion has been closed.