Input type as text instead of search for search bar

Input type as text instead of search for search bar

baokybaoky Posts: 8Questions: 6Answers: 0

Data Table input type as text instead of search

I have a system that populate data table using CakePHP and the amazing part is

its search field was something like this

<input type="text" aria-controls="c_table">

And the date table i populate was

<input type="search" class="" placeholder="" aria-controls="c_table">

How do I change my own populated data table search bar as input type "text" instead of "search"

var dt = $('#clients_table').DataTable( {
        "processing": true,
        "serverSide": true,
"oLanguage": {
"sSearch": "Search"},
"sDom": '<"top"f>irt<"bottom"lp><"clear">'

Above is part of my data table declaration but I think that does not affect the search bar to be search instead of text, I wonder how cake PHP actually change the search as text for data table.

Thanks for helping

Answers

  • ManOrMonsterManOrMonster Posts: 5Questions: 1Answers: 0

    Did you figure this out? I'm having the same issue.

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin

    Just use a little bit of jQuery after you initialise the table: $('div.dataTables_filter input').attr( 'type', 'text' );

    Allan

  • ManOrMonsterManOrMonster Posts: 5Questions: 1Answers: 0

    Very good, thank you.

This discussion has been closed.