Reset button for search field

Reset button for search field

Shashidhar.nkShashidhar.nk Posts: 21Questions: 5Answers: 0

Hi Allan,

I need to provide a reset button for search field. But As you mentioned here in the discussion
https://datatables.net//forums/discussion/comment/90418/#Comment_90418 ,
Bootstrap's styling will remove the clear icon from the search input. This is part of Bootstrap.

Is there any way to override style for Search field only???
cause, other than Datatables, full web page is built with bootstrap styling.
If bootstrap library is removed, reset button appears and works fine, but whole page looks VERY Ugly. Help me out.

Replies

  • allanallan Posts: 63,689Questions: 1Answers: 10,500 Site admin

    Add this to your CSS:

    input[type="search"]::-webkit-search-cancel-button {
        -webkit-appearance: searchfield-cancel-button;
    }
    

    It will override Bootstrap's hiding of the clear button.

    Allan

  • Shashidhar.nkShashidhar.nk Posts: 21Questions: 5Answers: 0

    Hi Allan,

    Thank You. Reset button appears now and works fine.

  • wolfarwolfar Posts: 1Questions: 0Answers: 0

    Hi Allan,
    All work fine.

This discussion has been closed.