DEV Community

Discussion on: Amazing Clear Input Using HTML & JS

Collapse
 
kylesureline profile image
Kyle Scheuerlein

Well, as with everything... it has trade offs.

With your approach you get full control over the design of the β€œx”, but it requires JS and you need to use care to make sure it remains accessible.

With <input type=β€œsearch” /> you can’t change the look of the β€œx”, but it will match their OS, which could be desirable! It also won’t require JS to function and should be accessible.

Thread Thread
 
nikhil27b profile image
Nikhil Bobade

I updated my code πŸ˜ƒ