Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

input type search hide the icons

Tags:

html

In chrome, when I type in a search field, there appears a cross which clears the field when clicked (one can also use Esc for this).

  <input type="search">

Is there any way to hide this cross?


EDIT:

If you use attribute results="2", it starts showing a magnifying glass too. what kind of sorcery is this? Why does the glass shows up when I use the results attribute?

<input type="search" results="2">
like image 987
Sourabh Avatar asked Sep 17 '13 17:09

Sourabh


1 Answers

Sourabh you will need to disable WebKit’s proprietary pseudo elements

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

Let me know if this helps

For your case use:

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}
<input type="search">
like image 177
neoeahit Avatar answered Oct 08 '22 20:10

neoeahit