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.
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.I updated my code ๐