jQWidgets jqxColorPicker colorchange Event
jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful and optimized framework, platform-independent, and widely supported. The jqxColorPicker widget is a jQuery UI widget that is used to create a color picker.
The colorchange event is used to trigger when a new color is picked from the color picker. Every time when the color value change, this event is called. It is of the event type.
Syntax:
$('Selector').bind('colorchange', function (event) {
var colorPick = event.args;
});
Linked Files: Download jQWidgets from the link. In the HTML file, locate the script files in the downloaded folder:
<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcolorpicker.js”></script>
Example: The below example illustrates the jqxColorPicker colorchange event in jQWidgets.
HTML
<!DOCTYPE html>
< html lang = "en" >
< head >
< link rel = "stylesheet" href =
"jqwidgets/styles/jqx.base.css"
type = "text/css" />
< script type = "text/javascript"
src = "scripts/jquery-1.11.1.min.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxcore.js" >
</ script >
< script type = "text/javascript"
src = "jqwidgets/jqxcolorpicker.js" >
</ script >
</ head >
< body >
< center >
< h1 style = "color: green;" >
GeeksforGeeks
</ h1 >
< h3 >
jQWidgets jqxColorPicker colorchange Event
</ h3 >
< div id = 'jqxCP' ></ div >
</ center >
< script type = "text/javascript" >
$(document).ready(function () {
$("#jqxCP").jqxColorPicker({
width: 450,
height: 300
});
$('#jqxCP').bind('colorchange', function (event) {
alert("Color has been changed!");
});
});
</ script >
</ body >
</ html >
|
Output:
Note: This event works properly with Firefox.
Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxcolorpicker/jquery-colorpicker-api.htm?search=
Last Updated :
23 May, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...