66
Views
2
Comments
Solved
input type search doesn't work (iOS)

Hi,

When we use a search type input, the icon to clean the field does not work on iphone but it works on Android.

Do we need to add some extra element to make it work?


Thanks!

2024-06-14 05-30-18
Carlos Ardiles
Solution

Hi Fabian,

The Input type search is no different from a normal input type text, and so the functionality you describe depends on the User-Agent / Browser interpreting it.

So in this case, for a Mozilla based browser the functionality should be similar to the one explained in this link:
https://developer.mozilla.org/es/docs/Web/HTML/Elemento/input/search

As for iOS Safari, the "x" icon to clear the input text does not work natively in mobile Safari, in this Stackoverflow thread a JS solution is discussed:
https://stackoverflow.com/questions/613114/little-x-in-textfield-input-on-the-iphone-in-mobilesafari

Hope this is helpful to you.

UserImage.jpg
Fabian Godoy


Thank you Carlos for your time.

Hi Fabian,

The Input type search is no different from a normal input type text, and so the functionality you describe depends on the User-Agent / Browser interpreting it.

So in this case, for a Mozilla based browser the functionality should be similar to the one explained in this link:
https://developer.mozilla.org/es/docs/Web/HTML/Elemento/input/search

As for iOS Safari, the "x" icon to clear the input text does not work natively in mobile Safari, in this Stackoverflow thread a JS solution is discussed:
https://stackoverflow.com/questions/613114/little-x-in-textfield-input-on-the-iphone-in-mobilesafari

Hope this is helpful to you.



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.