Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close an html5 color picker?

In chrome on OSX when you select a color using a input with type=color:

<input name="color" type="color" />

The color picker stays open even after choosing a color. It stays open even when you reload the page.

How can I close this picker popup when a color is chosen?

like image 820
user1391445 Avatar asked Dec 01 '15 19:12

user1391445


People also ask

How do I disable color picker?

To achieve disabled state in ColorPicker, set the disabled property to true . The ColorPicker pop-up cannot be accessed in disabled state.


1 Answers

The color picker depends heavily on a per-browser, per-platform implementation. There's technically no way to close the color picker programatically as a cross-browser solution.

What you can do instead is using a Javascript solution to render your own, cross-platform color picker like jscolor or similar, those even have proper touch support.

Edit: In this list you can see there's no close event in the input type="color". Further reading tells me that since this is just an input like a text input or range input, it's not something you can "control". The alternative may be creating your own.

like image 151
Patrick D'appollonio Avatar answered Oct 04 '22 17:10

Patrick D'appollonio