Disable Search autocomplete

Disable Search autocomplete

icefieldicefield Posts: 45Questions: 19Answers: 1

What's the recommended method to turn off autocomplete for Data Table search, not within an individual field, but for the search field that appears outside the table?

I found this, https://datatables.net/forums/discussion/comment/152096/#Comment_152096, but that didn't work for me.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 9,532Questions: 0Answers: 1,577

    That should work, as it's just an element attribute - see here. It might be worth checking StackOverflow to see if there are other suggested approaches.

    Colin

  • icefieldicefield Posts: 45Questions: 19Answers: 1

    Bit more investigation revealed the following worked at turning autocomplete off for just the global search field.

            initComplete: function() {
                $(this.api().table().container()).find('input').attr('autocomplete', 'off');
            },
    

    The code in the lined article above added "autocomplete=off" to every input field in the table. That is not what I needed in my case. I only needed the global search field above the table.

  • colincolin Posts: 9,532Questions: 0Answers: 1,577
    Answer ✓

    Perfect, thanks for reporting back,

    Colin

Sign In or Register to comment.