updated enableColorPicker to accept either a jQ obj or a string; updated it to be able to initialize several inputs at once

v1.18.x
psychobunny 11 years ago
parent 29137299c2
commit 4cf6ebda7b

@ -5,15 +5,19 @@ var admin = {};
(function() {
admin.enableColorPicker = function(inputEl, callback) {
inputEl.ColorPicker({
color: inputEl.val() || '#000',
onChange: function(hsb, hex) {
inputEl.val('#' + hex);
if (typeof callback === 'function') {
callback(hsb, hex);
(inputEl instanceof jQuery ? inputEl : $(inputEl)).each(function() {
var $this = $(this);
$this.ColorPicker({
color: $this.val() || '#000',
onChange: function(hsb, hex) {
$this.val('#' + hex);
if (typeof callback === 'function') {
callback(hsb, hex);
}
}
}
});
});
});
};
}());
Loading…
Cancel
Save