Can I move the search box to the left?

Can I move the search box to the left?

amarundoamarundo Posts: 6Questions: 3Answers: 0

Hi,

Using the Bootstrap styling...
Can I move the search box to the left?
And once I do that, can I remove the word "Search" and the colon?
And once I do that, maybe add placeholder text inside the box?

Thanks!

This question has an accepted answers - jump to answer

Answers

  • glendersonglenderson Posts: 231Questions: 11Answers: 29
    Answer ✓

    DOM feature to position the search box here -

    https://datatables.net/reference/option/dom

    Placeholder, search value described here -

    https://datatables.net/reference/option/language.searchPlaceholder

  • amarundoamarundo Posts: 6Questions: 3Answers: 0

    Thanks, very useful.

  • countershanecountershane Posts: 3Questions: 0Answers: 0

    this is kind of useful, but is there a way to move the search box to the left if I'm not using bootstrap styling?
    Thanks

  • mackmackmackmack Posts: 15Questions: 1Answers: 2

    Yes you can make a class in your css like:
    .pull-left{
    float: left !important;
    }

    and then add this class to datatable search div using jquery or javascript.

    example:
    $('.dataTables_filter').addClass('pull-left');

    make sure your script is in the head part of your html.

  • countershanecountershane Posts: 3Questions: 0Answers: 0

    Thanks!

  • countershanecountershane Posts: 3Questions: 0Answers: 0

    I found that adding:
    .dataTables_filter {
    text-align: left !important;
    }
    to the css also works.

  • androclusandroclus Posts: 2Questions: 0Answers: 0
    edited April 2018

    Like countershane's last example, the simplest solution for me, too, was to just add his 3 lines to the CSS, BUT replace text-align with float:

    .dataTables_filter {
       float: left !important;
    }
    
This discussion has been closed.