Reset button for search field

Reset button for search field

Shashidhar.nkShashidhar.nk Posts: 9Questions: 1Answers: 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: 42,159Questions: 1Answers: 5,357 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: 9Questions: 1Answers: 0

    Hi Allan,

    Thank You. Reset button appears now and works fine.

Sign In or Register to comment.