Skip to main content

Event handling

Attaching event listeners​

You can attach event listeners with the colorpicker.events.on() method:

colorpicker.events.on("modeChange", function(view) {
console.log("Selected mode: " + view);
});
note

Event names are case-insensitive.

Related sample: Colorpicker. Events

Detaching event listeners​

You can detach event listeners with the colorpicker.events.detach() method:

colorpicker.events.on("modeChange", function(view) {
console.log("Selected mode: " + view);
});

colorpicker.events.detach("modeChange");

Calling events​

You can call events with the colorpicker.events.fire() method:

colorpicker.events.fire("name",args);
// where args is an array of arguments

The list of events​

The API section lists all Colorpicker events.